vadugwi / interpret.js
deucebucket's picture
All-neutral projective pool (multi-model consensus) + per-dimension scoring + reworded notes
4fcf639 verified
Raw
History Blame Contribute Delete
23.6 kB
/* interpret.js — VADUGWI "Read the Room" deep interpretation.
Replaces the shallow horoscope buildInsights with combination-driven,
grounded, second-person reads. Pure & deterministic — no DOM, no randomness.
Sets window.RTR_INTERPRET in browser; exports for Node test harness. */
(function (root) {
'use strict';
// ---- thresholds (shared language across the whole read) ----
// 128 = neutral center. "low" / "high" bands mirror the original getReading.
var LO = 100; // clearly below center
var VLO = 80; // markedly low
var HI = 156; // clearly above center
var VHI = 180; // markedly high
function lo(v) { return v < LO; }
function vlo(v) { return v < VLO; }
function hi(v) { return v > HI; }
function vhi(v) { return v > VHI; }
function mid(v) { return v >= LO && v <= HI; }
// Reading word per dimension (richer port of getReading).
// For each dim: lo word, slightly-lo, center, slightly-hi, hi word.
function readingWord(val, loWord, hiWord) {
if (val < VLO) return loWord;
if (val < 118) return 'slightly ' + loWord;
if (val > VHI) return hiWord;
if (val > 138) return 'slightly ' + hiWord;
return 'balanced';
}
var DIM_META = [
{ key: 'V', name: 'Valence', lo: 'negative bias', hi: 'positive bias' },
{ key: 'A', name: 'Arousal', lo: 'flat', hi: 'reactive' },
{ key: 'D', name: 'Dominance', lo: 'powerless', hi: 'in control' },
{ key: 'U', name: 'Urgency', lo: 'unpressured', hi: 'everything urgent' },
{ key: 'G', name: 'Gravity', lo: 'heavy', hi: 'light' },
{ key: 'W', name: 'Self-Worth', lo: 'self-critical', hi: 'self-assured' },
{ key: 'I', name: 'Intent', lo: 'withdrawing', hi: 'connecting' }
];
// Specific per-dimension sentence about how that score shapes movement
// through situations. Three bands: low / center / high.
function dimLine(key, val) {
var bands = {
V: {
low: 'When a situation could go either way, you tend to read it as the bad version. This kind of negative interpretation bias is well studied: ambiguous input gets resolved toward threat before the facts are in.',
mid: 'You read good as good and bad as bad without much tilt — ambiguous situations stay genuinely open until you have more to go on.',
high: 'You tend to give ambiguous situations the benefit of the doubt; the uncertain reads as promising more often than not.'
},
A: {
low: 'Your reactions stay low and even — situations that spike most people land softly. Whether that is steadiness or blunting depends on the rest: paired with low self-worth or withdrawal it reads more like emotional blunting than calm.',
mid: 'Your reactions scale to the event: small things stay small, big things move you, without overshooting.',
high: 'Your arousal climbs quickly — events register at high intensity, so you catch real signals but also more false alarms.'
},
D: {
low: 'Situations tend to feel like things happening to you rather than things you steer. In the circumplex models of affect, this is the low-dominance end: a sense of being acted upon, with agency dropping first when pressure rises.',
mid: 'You hold a workable sense of agency — you can be acted upon without losing the thread that you also get to act.',
high: 'You move through situations with a hand on the wheel; even hard moments read as things you can influence.'
},
U: {
low: 'Few things read as needing action right now — you let situations breathe instead of treating them as alarms.',
mid: 'You sort the genuinely time-sensitive from the merely loud reasonably well; not everything becomes an emergency.',
high: 'Many ordinary situations read as needing a response immediately — the clock feels louder than it usually is, which is part of how chronic threat-readiness shows up.'
},
G: {
// NOTE: low G = heavy (the harder read), high G = light.
low: 'Small things land with weight they may not warrant; your system braces, so events arrive heavier than their actual size.',
mid: 'Weight scales to the event — the small stays small and the serious gets taken seriously.',
high: 'Things tend to land light; you can let events roll off, though genuinely heavy ones may get waved off too.'
},
W: {
low: 'When something is unclear or critical, the verdict you reach for is about you — the blank fills in with "it is me, and it is bad." This is the self-directed edge of negative interpretation bias.',
mid: 'Your self-evaluation holds reasonably steady under criticism and praise alike — feedback informs you without redefining you.',
high: 'You tend to meet criticism and comparison from solid ground; a hard moment reads as information, not a referendum on your worth.'
},
I: {
low: 'When things get ambiguous or painful, the instinct is to pull back. This is the withdrawal end of the approach–avoidance dimension — protective, but it can close the door on people who would show up.',
mid: 'You can both protect yourself and stay reachable; you neither cling nor vanish when a situation turns.',
high: 'Even in the ambiguous or the painful, you tend to lean toward reaching out rather than away — the approach side of approach–avoidance.'
}
};
var b = bands[key];
if (val < VLO) return b.low;
if (val > VHI) return b.high;
if (key === 'G') { if (val < 118) return b.low; if (val > 138) return b.high; }
else { if (val < 118) return b.low; if (val > 138) return b.high; }
return b.mid;
}
// ---------------- ARCHETYPES (multi-dimension headlines) ----------------
// Each: { id, title, body, when(p) } where p = profile. First match in order
// wins, so most-specific / most-acute patterns come first. A default closes.
var ARCHETYPES = [
{
id: 'inward_collapse',
title: 'When something goes wrong, you turn it inward — and assume you can’t change it',
when: function (p) { return vlo(p.V) && vlo(p.W) && lo(p.D); },
body: 'When things go sideways you do not just see the bad — you make it about you, and you assume you cannot change it. Negative read on the world, low self-worth, and low sense of agency tend to move together here. Researchers studying depression describe a similar pattern as the negative cognitive triad — pessimism about the self, the world, and the future — alongside what is called learned helplessness, the sense that the exit is bolted shut. That is the lens at work, not the size of what happened.'
},
{
id: 'harsh_alarm',
title: 'You spike hard, and the alarm turns on you',
when: function (p) { return vhi(p.A) && lo(p.W); },
body: 'You react fast and then turn the reaction on yourself. High arousal paired with a low self-worth baseline means the alarm goes off loudly and the first thing it accuses is you. You feel things at full intensity and read much of that intensity as evidence against yourself — the self-directed form of negative interpretation bias.'
},
{
id: 'braced',
title: 'Most situations land as urgent, heavy, and loud',
when: function (p) { return hi(p.A) && hi(p.U) && lo(p.G); },
body: 'Everything tends to arrive urgent, heavy, and loud — the pattern researchers describe as chronic hyperarousal, or hypervigilance: a threat-response system that stays switched on. Small events come in needing an immediate answer and landing harder than their size. This is what sustained bracing looks like from the inside — not drama, but a system that never got the all-clear.'
},
{
id: 'powerless_pressured',
title: 'You feel pushed to act and unable to act at the same time',
when: function (p) { return lo(p.D) && hi(p.U); },
body: 'You feel pressure to act and at the same time feel unable to. High urgency on top of low agency is a vise: the situation demands a response now, but the part of you that would steer it feels overruled before it starts. That gap between demand and means is genuinely depleting, and it is not a character flaw — it tracks the position you were put in.'
},
{
id: 'flatliner',
title: 'Your needle barely moves, and the world reads dim',
when: function (p) { return vlo(p.A) && lo(p.V); },
body: 'Your arousal stays low while the world reads dim. Flat affect paired with low valence is consistent with emotional blunting or anhedonia — but it can also be hard-won equanimity, and the two look alike from outside. The tell is in your other dimensions: if self-worth and reaching out are also low, this is more likely protective blunting than calm; if those hold up, it reads as steadiness. Either way, it is worth being gentle about.'
},
{
id: 'steady_keel',
title: 'You react in proportion and read situations near their true size',
when: function (p) { return mid(p.A) && mid(p.V) && p.W >= LO && p.D >= LO; },
body: 'You react in proportion, you read situations near their actual size, and you do it from reasonably solid ground. Good lands as good, bad lands as bad, and neither tips the whole boat. This is well-calibrated appraisal — steadiness backed by intact self-worth and agency, not flatness — and it is rarer than it tends to feel from the inside.'
},
{
id: 'open_door',
title: 'You let the good in, and you reach back',
when: function (p) { return hi(p.V) && hi(p.I) && hi(p.W); },
body: 'You let the good in and you reach back. Positive valence, intact self-worth, and a tendency to move toward people line up here — what researchers call positive affectivity and an approach orientation. Warmth registers as warmth, you trust it enough to move toward it, and you do not pre-discount yourself out of it. This is the configuration that turns good moments into bonds.'
},
{
id: 'guarded_warmth',
title: 'You read the room fine — you just hold back the reach',
when: function (p) { return lo(p.I) && p.V >= LO; },
body: 'You see the good clearly enough — you just hold back the reach. The world is not reading as hostile, but your instinct when a situation opens up is to step back rather than toward it. This is the avoidant, or withdrawal, side of approach–avoidance: the read is fine, it is the reaching that gets withheld, usually a learned safety move rather than a lack of feeling.'
},
{
id: 'tender_reactive',
title: 'Things reach you easily, and they land heavy',
when: function (p) { return hi(p.A) && lo(p.G); },
body: 'Things reach you easily and land heavy. High arousal plus heavy gravity means the small stuff does not stay small — it gets in, and it sits. You are not overreacting by choice; your system is amplifying on the way in, and the intensity is set higher than the room calls for.'
},
{
id: 'self_assured',
title: 'Your worth holds steady, and you feel some hand on the wheel',
when: function (p) { return hi(p.W) && p.D >= LO; },
body: 'Your sense of worth holds steady and you feel some hand on the wheel — intact self-worth alongside a real sense of agency. Criticism informs you instead of indicting you, and situations read as things you can influence. From here, hard moments register as problems to work, not verdicts to absorb.'
},
{
id: 'dim_lens',
title: 'You read situations darker than they are, but you don’t turn it on yourself',
when: function (p) { return lo(p.V) && p.W >= LO; },
body: 'You read ambiguous situations darker than they are, but you do not necessarily turn it on yourself. Your self-worth stays roughly intact; it is the world that comes in tinted. This is negative interpretation bias aimed outward — a sensitive threat read that catches real danger and also colors a lot of safe ground as suspect.'
},
{
id: 'light_touch',
title: 'Events land light, and you tend to find the upside',
when: function (p) { return hi(p.G) && hi(p.V); },
body: 'Events land light and read good — a positivity offset, the tendency to lean toward the kinder reading at baseline. You let things roll off and tend to find the upside, which supports day-to-day resilience. The only watch-out is that the genuinely heavy can get waved off before it is felt. Mostly, though, this is an easy weather system to live inside.'
},
{
id: 'quiet_pressure',
title: 'You look composed on the surface while the clock runs underneath',
when: function (p) { return vlo(p.A) && hi(p.U); },
body: 'On the surface you barely react, but underneath the clock is always running. Low outward arousal over a high urgency baseline is a particular kind of strain: you look composed while privately treating most things as needing an answer now. The cost of holding that gap is real even when no one sees it.'
}
];
var DEFAULT_ARCHETYPE = {
id: 'mixed_weather',
title: 'Your dimensions pull in different directions — no single pattern fits',
body: 'Your profile does not sit cleanly in one pattern — different dimensions pull in different directions, which is how most real people read. The detail below is where your particular mix lives: notice which dimensions ran to the edges and which stayed near center, because the edges are where your filter shapes situations most.'
};
function pickArchetype(p) {
for (var i = 0; i < ARCHETYPES.length; i++) {
if (ARCHETYPES[i].when(p)) return ARCHETYPES[i];
}
return DEFAULT_ARCHETYPE;
}
// ---------------- COMBINATION INSIGHTS ----------------
// Multi-dimension couplings. Each fires from a condition and tags tone.
function buildInsights(p) {
var out = [];
// W -> V: low self-worth darkens ambiguous events.
if (lo(p.W) && lo(p.V)) {
out.push({
title: 'Low self-worth is coloring how you read the world',
kind: 'warn',
body: 'Your low self-worth and your negative read on ambiguous situations tend to feed each other. When something is unclear, the blank gets filled with "it is about me, and it is bad," and that verdict then shades the next ambiguous thing. This is the self-referential side of negative interpretation bias — the world looks this way partly because the lens is set this way.'
});
}
// low D + high U: powerless but pressured.
if (lo(p.D) && hi(p.U)) {
out.push({
title: 'You read situations as urgent but yourself as unable to steer them',
kind: 'warn',
body: 'You read a lot of situations as urgent while also reading yourself as unable to steer them. High pressure paired with low agency is one of the more depleting states to hold, because the demand and the means point opposite ways — it overlaps with what stress research calls high-demand, low-control strain. Where you can, relief tends to come from reclaiming one small lever rather than answering the whole alarm.'
});
}
// high A + low W: reactive AND self-critical = harsh inner alarm.
if (hi(p.A) && lo(p.W)) {
out.push({
title: 'When you spike, the accusation lands on you',
kind: 'warn',
body: 'You react easily, and when you do, the accusation lands on you. A sensitive threat response is not the problem — aiming it inward is. The same speed that catches real danger is, in this configuration, also writing fast self-criticism you would never hand to anyone else.'
});
}
// Intent as the swing factor on a low-V profile.
if (lo(p.V)) {
if (hi(p.I)) {
out.push({
title: 'You read dark, but you still reach toward people',
kind: 'good',
body: 'Your valence runs negative, but your intent runs toward people anyway — and on a negative-read profile, that approach lean is the most protective thing here. Withdrawing would let the dark read go unchallenged; reaching out is exactly what brings in the outside evidence that argues with it.'
});
} else if (lo(p.I)) {
out.push({
title: 'You read dark and pull back, so the read never gets tested',
kind: 'warn',
body: 'You read ambiguous situations as negative, and when they turn you pull back rather than reach. Negative interpretation bias plus an avoidant, withdrawal lean tends to be self-sealing: stepping back removes exactly the contact that would test the dark reading, so it rarely gets corrected. Leaning even slightly toward reaching is what opens that loop.'
});
}
}
// high A + low G(heavy): everything reaches you and stays.
if (hi(p.A) && lo(p.G)) {
out.push({
title: 'Things reach you easily and then sit',
kind: 'neutral',
body: 'High arousal and heavy gravity work together: events reach you easily and then land with extra weight. You are not making things bigger than they are by choice — your system is amplifying on the way in and slow to set the weight back down.'
});
}
// high V + high W + high I: the reinforcing good loop.
if (hi(p.V) && hi(p.W) && hi(p.I)) {
out.push({
title: 'Reading good, holding your worth, and reaching out reinforce each other',
kind: 'good',
body: 'Reading good as good, holding your self-worth, and moving toward people support each other: warmth registers, you trust it, you move toward it, and the connection that follows confirms the read. This is the secure, approach-oriented configuration — positive affectivity that tends to build rather than erode.'
});
}
// Steady / balanced fallback.
if (!out.length) {
out.push({
title: 'Your dimensions are well calibrated, with no damaging loop',
kind: 'good',
body: 'No two dimensions are pulling against each other hard enough to set up a self-reinforcing loop. You read negative as negative, positive as positive, and neutral as neutral, from reasonably solid ground — what well-calibrated appraisal looks like in the data.'
});
}
// Reactivity (Arousal-as-swing): with an all-neutral pool, A measures how much
// genuinely neutral scenes move you — the natural read of your swing.
if (vlo(p.A)) {
out.push({
title: 'Neutral scenes barely move you',
kind: 'neutral',
body: 'Across scenes built to land blank, your needle hardly moved — you took most of them at close to face value. That can be hard-won steadiness or it can be muted affect, and the two look alike from outside; the tell is in your other dimensions. Either way, ambiguity does not pull strong feeling out of you the way it does for most people.'
});
} else if (vhi(p.A)) {
out.push({
title: 'Neutral scenes move you a lot',
kind: 'neutral',
body: 'Scenes built to land blank did not stay blank for you — you filled the ambiguity with strong feeling, swinging hard in one direction or the other. A reactive read like this catches real signal early, but it also colors a lot of genuinely empty space, so neutral rarely gets to stay neutral.'
});
} else {
out.push({
title: 'Neutral scenes move you in proportion',
kind: 'neutral',
body: 'On scenes built to land blank, you reacted in proportion — some pulled a little color out of you, most stayed close to neutral. You let the genuinely ambiguous stay ambiguous instead of rushing to fill it with strong feeling either way.'
});
}
// Always-present honest framing. Goes last so it reads as the footer it is.
out.push({
title: 'What this is',
kind: 'neutral',
body: 'This is a reflective self-report grounded in affect science — not a diagnosis, not a personality type, and not clinically validated. It describes tendencies and biases in how you answered today, which can shift, not fixed traits or conditions.'
});
return out;
}
// ---------------- TIER RESILIENCE READ (RETIRED) ----------------
// The pool is now all-neutral/projective — there are no NEG/POS tiers, so there
// is no floor/ceiling/baseline to compare. The "how much you swing" idea this
// section used to carry now lives in the Arousal-as-reactivity insight in
// buildInsights. tierRead is always null; the frontend hides it when null.
function tierRead(p) {
return null;
}
// ---------------- SPECIFIC CALLBACKS ----------------
// Every probe is a neutral, projective scene, so the scenes with the largest
// |dev| are simply the ones you colored most strongly — where your read filled
// an empty frame with the most feeling. Quote the real text back.
function buildCallbacks(p, max) {
var devs = (p.deviations || []).slice(0, max || 3);
var out = [];
for (var i = 0; i < devs.length; i++) {
var d = devs[i];
var ratingStr = (d.answer > 0 ? '+' : (d.answer < 0 ? '−' : '')) + Math.abs(d.answer);
if (d.answer === 0) ratingStr = '0';
out.push({ text: d.text, ratingStr: ratingStr, note: callbackNote(d) });
}
return out;
}
function callbackNote(d) {
var a = d.answer;
if (a <= -5) return 'an empty scene you read as a real loss — among the strongest negative colorings here.';
if (a < 0) return 'a blank moment you tilted toward the worse reading — your negative projection shows here.';
if (a >= 5) return 'an empty scene you read as a real lift — among the strongest positive colorings here.';
if (a > 0) return 'a blank moment you tilted toward the kinder reading.';
return 'a neutral scene you left neutral — you took it at face value.';
}
// ---------------- HEADLINE ----------------
function buildHeadline(p) {
var arch = pickArchetype(p);
return { title: arch.title, body: arch.body };
}
// ---------------- SAFETY LINE ----------------
// For very low V+W profiles, append one brief non-alarmist mirror line.
var MIRROR_LINE = ' One thing to hold alongside this: it is a reflection of how you answered today, a mirror — not a diagnosis or a verdict on you. The lens can be re-set, and a low read here is information, not a sentence.';
function needsMirror(p) {
return vlo(p.V) && vlo(p.W);
}
// ---------------- TOP-LEVEL ----------------
function interpret(profile, probes, answers) {
var p = profile;
var headline = buildHeadline(p);
if (needsMirror(p)) {
headline = { title: headline.title, body: headline.body + MIRROR_LINE };
}
var dimensions = DIM_META.map(function (d) {
var val = p[d.key];
return {
key: d.key,
name: d.name,
score: val,
reading: readingWord(val, d.lo, d.hi),
line: dimLine(d.key, val)
};
});
var insights = buildInsights(p);
var tr = tierRead(p);
var callbacks = buildCallbacks(p, 4);
return {
headline: headline,
dimensions: dimensions,
insights: insights,
tierRead: tr,
callbacks: callbacks
};
}
var api = { interpret: interpret };
if (typeof window !== 'undefined') window.RTR_INTERPRET = api;
if (typeof module !== 'undefined' && module.exports) module.exports = api;
if (typeof root !== 'undefined' && root && !root.RTR_INTERPRET) root.RTR_INTERPRET = api;
})(typeof globalThis !== 'undefined' ? globalThis : this);