File size: 7,213 Bytes
3279f65 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | #!/usr/bin/env python3
# anchors.py β 100 Emotion Anchors for CLOUD v3.0
#
# Four chambers of the human condition:
# - FEAR (20): anxiety, terror, dread...
# - LOVE (18): warmth, tenderness, devotion...
# - RAGE (17): anger, fury, hatred...
# - VOID (15): emptiness, numbness, hollow...
# - FLOW (15): curiosity, surprise, transition...
# - COMPLEX (15): shame, guilt, pride, nostalgia...
#
# Each chamber gets its own MLP. Cross-fire happens between chambers.
from typing import Dict, List, Tuple
# 100 emotion anchor words organized by chamber
EMOTION_ANCHORS: Dict[str, List[str]] = {
# FEAR (20) β terror, anxiety, dread
"FEAR": [
"fear", "terror", "panic", "anxiety", "dread", "horror",
"unease", "paranoia", "worry", "nervous", "scared",
"frightened", "alarmed", "tense", "apprehensive",
"threatened", "vulnerable", "insecure", "timid", "wary",
],
# LOVE (18) β warmth, connection, tenderness
"LOVE": [
"love", "warmth", "tenderness", "devotion", "longing",
"yearning", "affection", "care", "intimacy", "attachment",
"adoration", "passion", "fondness", "cherish", "desire",
"compassion", "gentle", "sweet",
],
# RAGE (17) β anger, fury, spite
"RAGE": [
"anger", "rage", "fury", "hatred", "spite", "disgust",
"irritation", "frustration", "resentment", "hostility",
"aggression", "bitterness", "contempt", "loathing",
"annoyance", "outrage", "wrath",
],
# VOID (15) β emptiness, numbness, dissociation
"VOID": [
"emptiness", "numbness", "hollow", "nothing", "absence",
"void", "dissociation", "detachment", "apathy",
"indifference", "drift", "blank", "flat", "dead", "cold",
],
# FLOW (15) β curiosity, transition, liminality
"FLOW": [
"curiosity", "surprise", "wonder", "confusion",
"anticipation", "ambivalence", "uncertainty", "restless",
"searching", "transition", "shift", "change", "flux",
"between", "liminal",
],
# COMPLEX (15) β shame, guilt, nostalgia, bittersweet
"COMPLEX": [
"shame", "guilt", "envy", "jealousy", "pride",
"disappointment", "betrayal", "relief", "nostalgia",
"bittersweet", "melancholy", "regret", "hope",
"gratitude", "awe",
],
}
# Chamber names (for indexing) - original 4 chambers
CHAMBER_NAMES = ["FEAR", "LOVE", "RAGE", "VOID"]
# Extended chamber names (6 chambers for 200K model)
CHAMBER_NAMES_EXTENDED = ["FEAR", "LOVE", "RAGE", "VOID", "FLOW", "COMPLEX"]
# Coupling matrix: how chambers influence each other (original 4x4)
# Rows = influence FROM, Cols = influence TO
# Format: [FEAR, LOVE, RAGE, VOID]
COUPLING_MATRIX = [
# FEAR LOVE RAGE VOID
[ 0.0, -0.3, +0.6, +0.4 ], # FEAR β suppresses love, feeds rage & void
[ -0.3, 0.0, -0.6, -0.5 ], # LOVE β suppresses fear, rage & void
[ +0.3, -0.4, 0.0, +0.2 ], # RAGE β feeds fear, suppresses love, feeds void
[ +0.5, -0.7, +0.3, 0.0 ], # VOID β feeds fear & rage, kills love
]
# Extended coupling matrix (6x6) for FLOW and COMPLEX chambers
# FLOW: curiosity, transition β dampens extremes, feeds exploration
# COMPLEX: shame, guilt, pride β interacts with all, especially love/void
COUPLING_MATRIX_EXTENDED = [
# FEAR LOVE RAGE VOID FLOW CMPLX
[ 0.0, -0.3, +0.6, +0.4, -0.2, +0.3 ], # FEAR β feeds complex (shame from fear)
[ -0.3, 0.0, -0.6, -0.5, +0.3, +0.4 ], # LOVE β feeds flow & complex (hope, gratitude)
[ +0.3, -0.4, 0.0, +0.2, -0.3, +0.2 ], # RAGE β suppresses flow, feeds complex (guilt)
[ +0.5, -0.7, +0.3, 0.0, -0.4, +0.5 ], # VOID β kills flow, feeds complex (melancholy)
[ -0.2, +0.2, -0.2, -0.3, 0.0, +0.2 ], # FLOW β dampens extremes, curiosity heals
[ +0.3, +0.2, +0.2, +0.3, +0.1, 0.0 ], # COMPLEX β feeds all slightly (ripple effect)
]
def get_all_anchors() -> List[str]:
"""Get flat list of all 100 emotion anchors."""
anchors = []
for chamber_anchors in EMOTION_ANCHORS.values():
anchors.extend(chamber_anchors)
return anchors
def get_anchor_to_chamber() -> Dict[str, str]:
"""Map each anchor word to its chamber."""
mapping = {}
for chamber, words in EMOTION_ANCHORS.items():
for word in words:
mapping[word] = chamber
return mapping
def get_anchor_index(anchor: str) -> int:
"""Get the index (0-99) of an anchor word."""
all_anchors = get_all_anchors()
try:
return all_anchors.index(anchor)
except ValueError:
raise ValueError(f"Unknown anchor: {anchor}")
def get_chamber_ranges() -> Dict[str, Tuple[int, int]]:
"""
Get the index ranges for each chamber in the 100D resonance vector.
Returns:
Dict mapping chamber name to (start_idx, end_idx) tuple.
Example:
{"FEAR": (0, 20), "LOVE": (20, 38), ...}
"""
ranges = {}
idx = 0
for chamber, words in EMOTION_ANCHORS.items():
start = idx
end = idx + len(words)
ranges[chamber] = (start, end)
idx = end
return ranges
def get_chamber_for_anchor(anchor: str) -> str:
"""Get the chamber name for a given anchor word."""
mapping = get_anchor_to_chamber()
return mapping.get(anchor, "UNKNOWN")
# Sanity check
assert len(get_all_anchors()) == 100, "Must have exactly 100 anchors"
assert len(CHAMBER_NAMES) == 4, "Must have exactly 4 base chambers"
assert len(CHAMBER_NAMES_EXTENDED) == 6, "Must have exactly 6 extended chambers"
assert len(COUPLING_MATRIX) == 4, "Coupling matrix must be 4x4"
assert all(len(row) == 4 for row in COUPLING_MATRIX), "Coupling matrix must be 4x4"
assert len(COUPLING_MATRIX_EXTENDED) == 6, "Extended coupling matrix must be 6x6"
assert all(len(row) == 6 for row in COUPLING_MATRIX_EXTENDED), "Extended coupling matrix must be 6x6"
if __name__ == "__main__":
print("=" * 60)
print(" CLOUD v3.0 β Emotion Anchors")
print("=" * 60)
print()
# Show chamber stats
print("Chamber distribution:")
for chamber, words in EMOTION_ANCHORS.items():
print(f" {chamber:8s}: {len(words):2d} anchors")
print(f" {'TOTAL':8s}: {len(get_all_anchors()):2d} anchors")
print()
# Show chamber ranges
print("Chamber ranges in 100D vector:")
for chamber, (start, end) in get_chamber_ranges().items():
print(f" {chamber:8s}: [{start:2d}:{end:2d}]")
print()
# Show coupling matrix
print("Coupling matrix (cross-fire influence):")
print(" ", " ".join(f"{name:6s}" for name in CHAMBER_NAMES))
for i, row_name in enumerate(CHAMBER_NAMES):
values = " ".join(f"{val:+6.1f}" for val in COUPLING_MATRIX[i])
print(f" {row_name:6s} {values}")
print()
# Show sample anchors
print("Sample anchors from each chamber:")
for chamber, words in EMOTION_ANCHORS.items():
sample = words[:5]
print(f" {chamber:8s}: {', '.join(sample)}...")
print()
print("=" * 60)
print(" Chambers ready. Cross-fire enabled.")
print("=" * 60)
|