Completion results
Shape of each suggestion from
Complete().
interface GlyphCompletionResult { token: string; score: number; count: number; comparison: GlyphComparisonResult; source: { key: string; glyph: Glyph; };}Fields
Section titled “Fields”| Field | Type | Meaning |
|---|---|---|
token |
string |
Suggested next word |
score |
number |
Glyph-guided rank (0–1) |
count |
number |
Markov transition count |
comparison |
GlyphComparisonResult |
Probe vs primary source glyph |
source.key |
string |
Ingest key of the primary source document |
source.glyph |
Glyph |
Primary source document glyph |
Primary source
Section titled “Primary source”When a transition has multiple source glyphs, the primary source is the one with the highest similarity to the probe. That source supplies:
source.keysource.glyphcomparison
comparison object
Section titled “comparison object”{ "similarity": 0.38, "matches": 49, "distance": 79, "size": 128}Sort order
Section titled “Sort order”Results are sorted by:
scoredescendingcountdescendingtokenascending (stable tiebreak)
Empty results
Section titled “Empty results”Complete() returns [] when:
- Prefix has fewer than
order - 1tokens (fororder > 1) - No transitions exist for the resolved state key
- All candidates are below
minCount
Example
Section titled “Example”[ { "token": "moon", "score": 0.38, "count": 2, "comparison": { "similarity": 0.38, "matches": 49, "distance": 79, "size": 128 }, "source": { "key": "moon-doc", "glyph": "<Uint32Array>" } }, { "token": "sun", "score": 0.21, "count": 1, "comparison": { "similarity": 0.21, "matches": 27, "distance": 101, "size": 128 }, "source": { "key": "sun-doc", "glyph": "<Uint32Array>" } }]