symfonic.capabilities.memory.linking¶
linking ¶
Entity linking: the same surface, mentioned repeatedly, becomes a node.
A memory that says "we met at Cafe Milano" and another that says "Cafe Milano again" are two episodes about one thing. Linking mints that thing as a semantic memory and records that the two co-mentioned surfaces belong together, so a later retrieval can reach one through the other.
Three refusals shape the output, and each is a false-positive tax the shipped phase already pays:
- A single mention is not an entity.
min_mention_countexists because every capitalised word in one sentence would otherwise become a permanent fact about the tenant. - The heuristic extractor is opt-in by threshold. It reports every
capitalised token at
0.4, under the0.5default threshold, so wiring it changes nothing until a deployment lowers the bar deliberately. That is the shipped behaviour (design §16.0 Q2) and it is preserved on purpose: a regex that promotes proper nouns by default fills a graph with sentence starts. - Reading is budgeted.
max_recordsbounds how much history one pass scans, because linking runs inside a consolidation cycle that has to end.
Surfaces are slugged into ids rather than used as ids. A record id lives in a rendered charset; "Cafe Milano/Berlin" would forge a delimiter, and an accented surface would not be expressible at all.
EntityLink
dataclass
¶
Two entities mentioned together in the same memory.
EntityMention
dataclass
¶
One surface form found in one memory.
HeuristicEntityExtractor ¶
Capitalised-token extraction with a stoplist. The zero-dependency default.
extract ¶
Every capitalised surface in text that survives the stoplist.
Source code in src/symfonic/capabilities/memory/linking.py
LinkingResult
dataclass
¶
LinkingResult(entities: tuple[MemoryRecord, ...] = (), links: tuple[EntityLink, ...] = (), dropped: tuple[tuple[str, str], ...] = ())
The entities one pass minted, the links between them, and the refusals.
link_entities ¶
link_entities(records: Sequence[MemoryRecord], *, scope: MemoryScope, extractor: HeuristicEntityExtractor | None = None, min_mention_count: int = 2, confidence_threshold: float = 0.5, max_records: int = 200) -> LinkingResult
Mint entities for surfaces mentioned often enough, and link co-mentions.