Semantic
Import
import { getHouseThemeProfile, listHouseThemeProfiles, getTarotThemeProfile, listTarotThemeProfiles, tokenizeOccultThemeText, OCCULT_THEME_STOPWORDS,} from 'kaabalah/semantic';Exports
getHouseThemeProfilelistHouseThemeProfilesgetTarotThemeProfilelistTarotThemeProfilestokenizeOccultThemeTextOCCULT_THEME_STOPWORDS- Reading:
resolveCard,projectChart,buildReadingWeights,rankedSpheres,collapseHits,buildThreads(see Reading connections) - Reading reference:
getReadingReference,getDescentStep,getDescentMovement,DESCENT_ORDER,DESCENT_STEPS,DESCENT_MOVEMENT(see Reading reference and the descent) - Kaabalistic overlays:
getKaabalisticCorrespondenceTargets,getAstrologyTreeMarkers,getNumerologyTreeMarkers,getGematriaTreeMarkers,buildKaabalisticMapData, the symbol metadata getters, andgetKaabalisticLabel(see Kaabalistic overlays) - Cycle map:
buildCycleMapData,getCycleTreeMarkers,KAABALISTIC_CYCLE_WEIGHTS(see Cycle map) - Types:
HouseThemeProfile,TarotThemeProfile,HouseThemeLookup,TarotThemeLookup,HouseThemeAxis,HouseThemeScope,HouseNumber,OccultThemeCorrespondence,OccultThemeCorrespondences,TarotThemeCorrespondences,TarotMajorArchetypeReference,TokenizeOccultThemeTextOptions
Overview
The semantic module produces rich theme profiles for astrological houses and tarot cards. Each profile contains human-readable labels, aliases (including Portuguese), curated keywords, pre-tokenized search surfaces (tokens), and typed cross-system correspondences pulled from the Tree of Life graph (planets, signs, elements, spheres, paths, suits).
Profiles are built lazily on first access and cached in memory for the lifetime of the process.
House Theme Profiles
listHouseThemeProfiles()
Returns all 12 house theme profiles as a frozen array, one for each house from the 1st through the 12th.
const profiles = listHouseThemeProfiles();// profiles.length === 12getHouseThemeProfile(lookup)
Returns the HouseThemeProfile for a single house, or undefined if the lookup does not match.
HouseThemeLookup — accepts:
| Form | Example |
|---|---|
| House number (1–12) | 4 |
| Node ID string | id(WesternAstrologyTypes.HOUSE, WESTERN_HOUSES.IMUM_COELI) |
// Look up by house numberconst profile = getHouseThemeProfile(4);
// Look up by node IDimport { id, WesternAstrologyTypes, WESTERN_HOUSES } from 'kaabalah/core';const profile = getHouseThemeProfile( id(WesternAstrologyTypes.HOUSE, WESTERN_HOUSES.IMUM_COELI));HouseThemeProfile shape
interface HouseThemeProfile { kind: "house"; id: NodeId<WesternAstrologyTypes.HOUSE>; houseNumber: HouseNumber; // 1–12 houseLabel: string; // e.g. "Imum Coeli" primaryLabel: string; // e.g. "Family" scope: HouseThemeScope; // "personal" | "transition" | "transpersonal" axis: HouseThemeAxis; // polarity axis with opposite house aliases: readonly string[]; // English + Portuguese name variants keywords: readonly string[]; // curated thematic keywords tokens: readonly string[]; // normalized token surface for search/NLP correspondences: OccultThemeCorrespondences;}tokens is a superset of keywords — it also includes normalized names of the house’s correspondent planets, signs, elements, spheres, and paths from the Tree of Life.
HouseThemeScope classifies the house’s orientation:
"personal"— Houses 1–6, focused on the individual"transition"— House 7, the cusp between self and other"transpersonal"— Houses 8–12, focused beyond the self
HouseThemeAxis describes the polarity with the opposite house:
interface HouseThemeAxis { key: "self-other" | "resources-initiation" | "communication-journey" | "private-public" | "pleasure-friendship" | "health-occult"; label: string; // e.g. "Private and Public Life" oppositeHouseNumber: HouseNumber;}Correspondences
OccultThemeCorrespondences contains typed arrays of nodes from the Tree of Life, each with an id, display label, and graph distance from the house node:
interface OccultThemeCorrespondences { planets: readonly OccultThemeCorrespondence<WesternAstrologyTypes.PLANET>[]; signs: readonly OccultThemeCorrespondence<WesternAstrologyTypes.WESTERN_ZODIAC_SIGN>[]; elements: readonly OccultThemeCorrespondence<WesternAstrologyTypes.WESTERN_ELEMENT>[]; spheres: readonly OccultThemeCorrespondence<KaabalahTypes.SPHERE>[]; paths: readonly OccultThemeCorrespondence<KaabalahTypes.PATH>[];}
interface OccultThemeCorrespondence<T extends NodeType> { id: NodeId<T>; label: string; distance: number; // graph distance from the source node}Example
import { getHouseThemeProfile } from 'kaabalah/semantic';
const profile = getHouseThemeProfile(4);
console.log(profile?.primaryLabel); // "Family"console.log(profile?.scope); // "personal"console.log(profile?.axis.label); // "Private and Public Life"console.log(profile?.axis.oppositeHouseNumber); // 10
// Semantic search surfaceconsole.log(profile?.tokens);// ["family", "familia", "home", "roots", ..., "moon", "cancer", "water", "yesod", ...]
// Astrological correspondencesconsole.log(profile?.correspondences.planets[0]);// { id: "planet:Moon", label: "Moon", distance: 2 }House primary labels and scopes
| House | Primary Label | Scope |
|---|---|---|
| 1 | Images | personal |
| 2 | Money | personal |
| 3 | Communication | personal |
| 4 | Family | personal |
| 5 | Hobbies | personal |
| 6 | Health | personal |
| 7 | Associations | transition |
| 8 | Sex and Initiations | transpersonal |
| 9 | Travel and Knowledge | transpersonal |
| 10 | Career and Work | transpersonal |
| 11 | Friends | transpersonal |
| 12 | Past Lives | transpersonal |
Tarot Theme Profiles
listTarotThemeProfiles()
Returns the complete list of tarot theme profiles as a frozen array. The array covers all 78 cards — 22 Major Arcana and 56 Minor Arcana.
const profiles = listTarotThemeProfiles();// profiles.length === 78getTarotThemeProfile(lookup)
Returns the TarotThemeProfile for a single card, or undefined if not found.
TarotThemeLookup — the most flexible lookup in the library. Accepts:
| Form | Example |
|---|---|
| Card number (integer) | 16 |
| Card name string | "The Tower" |
| Alias / Egyptian name | "The House of God" |
| Filename string | "16_the_house_of_god" |
| Path slug string | "pe" |
| Node ID string | "tarotArkAnnu:The Tower" |
| Path node ID string | "path:16" |
Object with tarotCardNumber | { tarotCardNumber: 16 } |
Object with tarotCardFilename | { tarotCardFilename: "16_the_house_of_god" } |
Object with tarotCardName | { tarotCardName: "The Tower" } |
Object with tarotArkAnnuId | { tarotArkAnnuId: id(TarotTypes.TAROT_ARK_ANNU, "The Tower") } |
Object with pathId | { pathId: id(KaabalahTypes.PATH, "16") } |
Object with pathSlug | { pathSlug: "pe" } |
String lookups for names, aliases, and filenames are case-insensitive and diacritic-insensitive.
import { getTarotThemeProfile } from 'kaabalah/semantic';
// All of these return the same profile for The TowergetTarotThemeProfile(16);getTarotThemeProfile("The Tower");getTarotThemeProfile("The House of God"); // Egyptian name / aliasgetTarotThemeProfile("16_the_house_of_god"); // filenamegetTarotThemeProfile("tarotArkAnnu:The Tower"); // node IDgetTarotThemeProfile({ tarotCardNumber: 16 });getTarotThemeProfile({ pathSlug: "pe" });TarotThemeProfile shape
interface TarotThemeProfile { kind: "tarot"; id: NodeId<TarotTypes.TAROT_ARK_ANNU>; cardNumber: number; cardType: "major" | "minor"; tarotCardFilename: string; primaryLabel: string; // canonical card name, e.g. "The Tower" aliases: readonly string[]; // alternate names including Portuguese variants keywords: readonly string[]; // curated keyword tokens tokens: readonly string[]; // full normalized search surface correspondences: TarotThemeCorrespondences; majorArchetype?: TarotMajorArchetypeReference; // only for Major Arcana}TarotThemeCorrespondences extends OccultThemeCorrespondences with a suits array:
interface TarotThemeCorrespondences extends OccultThemeCorrespondences { suits: readonly OccultThemeCorrespondence<TarotTypes.TAROT_SUIT>[];}For Major Arcana cards, majorArchetype links the card to its path on the Tree of Life:
interface TarotMajorArchetypeReference { pathId: NodeId<KaabalahTypes.PATH>; pathNumber: number; pathSlug: string; // Hebrew letter slug, e.g. "pe" hebrewLetter: string; // e.g. "Peh"}Example
import { getTarotThemeProfile } from 'kaabalah/semantic';
const profile = getTarotThemeProfile("The Tower");
console.log(profile?.cardNumber); // 16console.log(profile?.cardType); // "major"console.log(profile?.tarotCardFilename); // "16_the_house_of_god"console.log(profile?.majorArchetype?.pathNumber); // 16console.log(profile?.majorArchetype?.hebrewLetter); // "Peh"
// Cross-system correspondencesconsole.log(profile?.correspondences.planets[0]);// { id: "planet:Saturn", label: "Saturn", distance: 3 }console.log(profile?.correspondences.signs[0]);// { id: "westernZodiacSign:Capricorn", label: "Capricorn", distance: 2 }Text Tokenization
tokenizeOccultThemeText(input, options?)
Normalizes and tokenizes a string (or array of strings) into a deduplicated list of lowercase ASCII tokens suitable for search indexing or fuzzy matching. Performs:
- Unicode NFD normalization and diacritic stripping (
á→a) - Lowercasing
- Splitting on non-alphanumeric characters
- Filtering by minimum length (default: 3)
- Removing stopwords (default:
OCCULT_THEME_STOPWORDS) - Deduplication in order of first occurrence
function tokenizeOccultThemeText( input: string | null | undefined | readonly (string | null | undefined)[], options?: TokenizeOccultThemeTextOptions): string[]
interface TokenizeOccultThemeTextOptions { minTokenLength?: number; // default: 3 stopwords?: readonly string[]; // default: OCCULT_THEME_STOPWORDS}import { tokenizeOccultThemeText } from 'kaabalah/semantic';
tokenizeOccultThemeText("Família, sonhos e retreat no subconscious");// ["familia", "sonhos", "retreat", "subconscious"]
// Batch tokenization across multiple stringstokenizeOccultThemeText(["The Tower", "The House of God", "Mars", "Capricorn"]);// ["tower", "house", "god", "mars", "capricorn"]
// Custom stopwords and minimum lengthtokenizeOccultThemeText("my dream of gold", { minTokenLength: 2, stopwords: ["my", "of"],});// ["dream", "gold"]OCCULT_THEME_STOPWORDS
A readonly string array of common English and Portuguese stopwords filtered during tokenization. Includes: "the", "and", "for", "with", "com", "sem", "por", "que", "não", "como", "mais", and many others. Pass a custom stopwords option to tokenizeOccultThemeText to override.
NLP / Search patterns
The tokens arrays on each profile are the main interface for text-matching occult themes against free-form user input. A typical pattern:
import { listHouseThemeProfiles, tokenizeOccultThemeText } from 'kaabalah/semantic';
const query = "I'm worried about my career and public reputation";const queryTokens = new Set(tokenizeOccultThemeText(query));
const profiles = listHouseThemeProfiles();const ranked = profiles .map((profile) => { const matches = profile.tokens.filter((token) => queryTokens.has(token)); return { profile, score: matches.length }; }) .filter(({ score }) => score > 0) .sort((a, b) => b.score - a.score);
// ranked[0].profile.houseNumber === 10 (Career and Work)The same approach works for tarot profiles via listTarotThemeProfiles().
Reading connections
resolveCard, projectChart, buildReadingWeights, rankedSpheres,
collapseHits and buildThreads combine tarot, I Ching and astrology into
structured Tree weights and connections.
import { resolveCard, buildReadingWeights, buildThreads } from 'kaabalah/semantic';import { getIChingReading } from 'kaabalah/iching';
const cards = [ resolveCard(20, 'conscious')!, resolveCard(66, 'unconscious')!, resolveCard(57, 'subconscious')!,];const input = { cards, iching: getIChingReading('687687'), natal: { planets: { mercury: 'Cancer' }, ascendant: null },};const weights = buildReadingWeights(input);// Hod 7, Yesod 3, Malkuth 2; path 20 three times, path 21 twice.const threads = buildThreads({ ...input, sky: null, day: null, birthday: null }, weights);Every major contributes its path and both endpoint spheres. Every pip contributes its sphere. Courts contribute no weight; Daath is excluded. Both trigrams in both cast and transformed hexagrams contribute their gate path and endpoints, without deduplication. The birth chart contributes only the subconscious pip’s sphere planet, when present. Ties go to the sphere higher on the Tree.
Connections carry system, key and structured fields. Consumers own sentence
templates and simple/detailed presentation; aspect rows have detail: true.
Connections never add weight. Birth charts retain signs, houses, rising and
major aspects. Horary houses require a known place. Day charts retain signs
and aspects only. Use projectChart(chart, { houses: false }) to omit rising
and houses when place or hour is unknown.
House and ruler context
A conscious major’s sign is also compared against every actual house cusp in the birth and horary charts. These are chart cusp signs, not the natural-zodiac house associated with the sign. The day chart has no house frame.
Pass selectedHouses: [2] when a human or calling application has explicitly
selected house 2 for the question. The library does not classify question prose.
All matching houses remain available; selected matches come first and carry
relevance.weight: 2 instead of 1. This is contextual priority, separate from
count and the Tree’s unchanged oracle weights.
The library also exposes the sign’s traditional domicile ruler, that planet’s
placements across all three charts, and drawn pips or planet-based majors that
carry the same planet. The rulership: 'traditional' marker identifies the
existing astrology module’s domicile table; general Kaabalah graph
correspondences are not silently treated as rulerships.
These rows have detail: true and
relevance.requiresHumanReview: true. They describe factual routes for a human
to assess, including Gemini → Mercury → a Hod pip without a matching house.
Their presence does not assert that the route answers the person’s question.
Consumers must preserve the review marker when passing these rows to models or
other readers, and keep their own sentence templates outside the library.
Reading reference and the descent
getReadingReference(language?) returns four frozen vocabularies keyed by sphere name (Kether … Malkuth, plus Daath), in English by default or Portuguese for pt / pt-BR.
| Field | Contents |
|---|---|
gloss | A short phrase for each of the eleven spheres |
rung | A pip’s step by its rank, '1' to '10'. Daath has no pip, so the ten ranks are unchanged |
step | Each sphere’s step of the eleven-step descent, in one line |
descent | The same step told in full: the idea becomes light, then sound, is expressed, planned with good feelings, weighed, harmonized, kept in silence, organized, checked for foundation and manifested |
movement | Display names of the three movements: expansion, contraction, balance |
The descent runs from the idea to matter with Daath included: Kether is step 1, Daath is step 4, and Malkuth is step 11.
The Tree is also a game of three movements, one per column: the right column (Chokhmah, Chesed, Netzach) expands, the left column (Binah, Geburah, Hod) contracts, and the middle column (Kether, Daath, Tiphareth, Yesod, Malkuth) balances the two. DESCENT_MOVEMENT maps each sphere to its movement and getDescentMovement(sphere) looks one up.
import { getReadingReference, getDescentStep, DESCENT_ORDER, DESCENT_STEPS,} from 'kaabalah/semantic';
DESCENT_ORDER; // ['Kether', 'Chokhmah', 'Binah', 'Daath', 'Chesed', ...]DESCENT_STEPS; // 11getDescentStep('sphere:Daath'); // 4 (a sphere node ID or a bare name)getDescentStep('Malkuth'); // 11getDescentStep('Path 5'); // null: not a sphere
const reference = getReadingReference('pt-BR');reference.step.Daath; // one line, in Portuguesereference.descent.Daath; // the full tellingreference.rung['1']; // the rank-1 pipThe reference is vocabulary only. It does not interpret a reading, and the app owns its sentence templates.
Kaabalistic overlays
These helpers turn astrology, numerology and gematria results into render-ready Tree of Life targets and markers. They compute no chart and draw nothing; pair them with kaabalah/visual (activations) or your own renderer.
import { getKaabalisticCorrespondenceTargets, getNumerologyTreeMarkers, getGematriaTreeMarkers, getAstrologyTreeMarkers, buildKaabalisticMapData,} from 'kaabalah/semantic';
// Which spheres and paths does a sign, planet, angle, node, number or Hebrew letter point at?getKaabalisticCorrespondenceTargets({ kind: 'sign', sign: 'Aries' });// { source: { kind: 'sign', label: 'Aries', glyph: '♈', ... },// targets: [{ targetId: 'path:5', targetType: 'path', mapping: 'sign-path', distance: 1 }, ...] }
getKaabalisticCorrespondenceTargets({ kind: 'planet', planet: 'Mars', sign: 'Aries' }, 'pt-BR');getKaabalisticCorrespondenceTargets({ kind: 'number', number: 7 });getKaabalisticCorrespondenceTargets({ kind: 'hebrewLetter', hebrewLetterId: 'hebrewLetter:Aleph' });
// Marker descriptors, one per placementgetNumerologyTreeMarkers(new Date(1990, 5, 15, 12)); // local noongetGematriaTreeMarkers('DAVID');getAstrologyTreeMarkers(chart); // a BirthChart
// Everything for a mixed map viewconst map = buildKaabalisticMapData({ astrology: chart, numerology: new Date(1990, 5, 15, 12), gematria: 'DAVID',});map.markers; // every markermap.sphereMarkers; // grouped by sphere node IDmap.pathMarkers; // grouped by path node IDmap.countsById; // per-target counts for highlightingmap.itemConnections; // per-source connection summaries (astrology, numerology, gematria)A marker has kind (astrology, numerology or gematria), targetId, targetType (sphere or path), sourceType, sourceName, mapping and a display label. lookup.kind selects what is being resolved: sign, planet, angle, node, number or hebrewLetter.
Symbol metadata for the glyphs and short labels is available through getPlanetSymbolMetadata(lookup), getZodiacSignSymbolMetadata(lookup), getAngleSymbolMetadata(lookup) and getNodeSymbolMetadata(lookup), and their listPlanetSymbolMetadata(), listZodiacSignSymbolMetadata(), listAngleSymbolMetadata() and listNodeSymbolMetadata() counterparts.
Portuguese labels
Every function above takes an optional final language argument. 'pt' and 'pt-BR' translate display labels (label, shortLabel, sourceName, targetName, item labels); glyphs, lookup keys, target IDs, mappings, distances and counts are unchanged. getKaabalisticLabel(text, language?) translates one supported standalone or generated label such as Path 5 or Mars in Aries, and returns anything it does not know unchanged.
Cycle map
buildCycleMapData(input, language?) answers “what is active for this person today” in the same shape as buildKaabalisticMapData, from the person’s current cycles instead of the birth data. getCycleTreeMarkers(input, language?) returns the markers alone. Both take computed data only and call no ephemeris; every part of the input is optional.
import { getTransitChart, getFirdaria, getAnnualProfection, findActiveDasha } from 'kaabalah/astrology';import { getNumerologySnapshot } from 'kaabalah/numerology';import { buildCycleMapData, KAABALISTIC_CYCLE_WEIGHTS } from 'kaabalah/semantic';
const transit = await getTransitChart({ natal, transitDate });const firdaria = getFirdaria(birthDate, isDiurnal, transitDate);const dasha = findActiveDasha(vimshottari, transitDate);
const day = buildCycleMapData({ transitAspects: transit.aspects, // TransitAspectEdge[] as is transitPlacements: transit.transitPlanets, // Record<string, TransitPlanet> as is timeLords: { firdariaMajor: firdaria.currentMajor.planet, // 'Venus', 'NorthNode', ... firdariaSub: firdaria.currentSub.planet, profection: getAnnualProfection(natalChart, birthDate, year).ruler, mahaDasha: dasha?.maha.lord, // 'venus', 'rahu', 'ketu', ... antarDasha: dasha?.antar?.lord, northNodeSign: natalChart.planets['mean node'].zodiacPosition.sign, }, numerology: getNumerologySnapshot(scheduleInput).calendar, // personalYear, personalMonth, personalDay});
day.rankedSpheres; // [{ id: 'sphere:Netzach', name: 'Netzach', share: 23.9, count: 5 }, ...]day.weightsById; // { 'sphere:Netzach': { transits: 10.01, timeLords: 5, numerology: 8.89, total: 23.9 }, ... }day.markers[0]; // { system: 'transits', cycleSource: 'transit-aspect', sourceName: 'transit Sun trine natal MC', timeLord: false, ... }The result has the fields of the birth map (spheres, paths, markers, sphereMarkers, pathMarkers, countsById, weightsById, rawWeightsById, rankedSpheres, rankedPaths, itemConnections). Its entries are split into transits, timeLords and numerology instead of astro, numerology and gematria, and each marker also carries system, cycleSource, and where they apply timeLord and retrograde.
KAABALISTIC_CYCLE_WEIGHTS is the weight table, and its doc comment states the rules:
| Source | Rule |
|---|---|
| Transit aspect | Counts only when its type is in transit.aspects (conjunction, sextile, square, trine, opposition) and its orb is transit.maxOrb (1 degree) or less. Lights up to three targets with the same weight: the sphere of the aspect, as in the birth map (cycleSource: 'transit-aspect'), the sphere of the natal planet it touches ('transit-natal-sphere'; Malkuth for the ASC, nothing for MC, nodes, Lilith and Chiron), and that planet’s path ('transit-natal-path': Sun 22, Moon 2, Mercury 17, Venus 3, Mars 11, Jupiter 4, Saturn 20; none for Uranus, Neptune, Pluto and other points). Weight is tightness (3 at exact, 1 at 1 degree) times the two bodies’ placement weights added together, over 10. |
| Time lord factor | An aspect whose transiting or natal body is a current time lord has all its markers multiplied by transit.timeLordFactor (2), once. |
| Transiting Moon | The only body in transit.skyBodies: it lights what a natal Moon in that sign lights, decan included, at transit.skyFactor (0.5) of the natal weight. Other transiting bodies count only through their aspects. |
| Time lords | Each lights its planet’s sphere: firdaria major 2, firdaria sub 1, profection lord 2, maha dasha 2, antar dasha 1. A node as lord lights the sphere of the natal node’s sign and needs timeLords.northNodeSign; the South Node and Ketu take the opposite sign. |
| Numerology | Personal day 4, personal month 3, personal year 2; an intermediate reduction step 1. |
| Shares | Spheres and paths are normalized separately so transits, time lords and numerology total 60, 20 and 20, rescaled over the systems present. |
Placement weights, the tightness scale and the pair divisor come from KAABALISTIC_MARKER_WEIGHTS. Aspects of the True Node and Lilith True are skipped, as in the birth map. countsById and the count of a ranked target count an aspect once, on the aspect’s sphere, so a sphere or path lit only as a natal planet has a share and a count of 0.