NlpEntityRegistry
Defined in: core/src/nlp/nlp.entities.ts:26
What a phrase filled, looked up by the slot object itself.
Addressing by slot rather than by name is what makes this typed: a slot
carries the type of its own values, so entities.get(room) is a Room[]
without anything having to restate that.
Every lookup answers an array. One phrase can fill a single slot several times
over — “the kitchen and the hallway lights” — and an interface that answered
with one value would have to pick, silently, which of them mattered. A slot the
phrase left alone answers [].
Named for the NLP sense of entity, an extracted span. Unrelated to EntityType, which is a searchable record type exposed as a tool.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new NlpEntityRegistry(matches?): NlpEntityRegistry;Defined in: core/src/nlp/nlp.entities.ts:29
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
matches |
Map<string, NlpEntityMatch<unknown>[]> |
Returns
Section titled “Returns”NlpEntityRegistry
Methods
Section titled “Methods”entries()
Section titled “entries()”entries(): [string, NlpEntityMatch<unknown>[]][];Defined in: core/src/nlp/nlp.entities.ts:47
Every filled slot’s id paired with its matches — for transports that have to serialise this.
Returns
Section titled “Returns”[string, NlpEntityMatch<unknown>[]][]
get<T>(slot): T[];Defined in: core/src/nlp/nlp.entities.ts:34
Every value matched for slot, in the order they appeared in the phrase.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
slot |
Slot<T> |
Returns
Section titled “Returns”T[]
has(slot): boolean;Defined in: core/src/nlp/nlp.entities.ts:44
Whether the phrase filled slot at all.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
slot |
Slot |
Returns
Section titled “Returns”boolean
matches()
Section titled “matches()”matches<T>(slot): NlpEntityMatch<T>[];Defined in: core/src/nlp/nlp.entities.ts:41
As NlpEntityRegistry.get, but keeping the matched text and accuracy.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
slot |
Slot<T> |
Returns
Section titled “Returns”NlpEntityMatch<T>[]