types/vocabulary.types.ts

types/vocabulary.types.ts is a file in Bane's Lab Site. 33 lines of code and 8 definitions.

import type { Tab } from "#types/document.types";

export interface VocabularyEntry {
    readonly code: string | null;
    readonly kind: string;
    readonly layer: string | null;
    readonly phrase: string;
    readonly prose: boolean;
    readonly ref: string;
}

export interface PageContent {
    readonly page: string;
    readonly tabs: readonly Tab[];
}

export interface BakedTabs {
    readonly name: string;
    readonly stem: string;
    readonly tabs: readonly Tab[];
}

export interface LinkedPage extends BakedTabs, PageContent {}

export interface PhraseMatch {
    readonly end: number;
    readonly entry: VocabularyEntry;
    readonly start: number;
}

export interface WordToken {
    readonly end: number;
    readonly start: number;
    readonly word: string;
}

export type PhraseCandidate = readonly [readonly string[], VocabularyEntry, readonly boolean[]];

export interface PhraseIndex {
    readonly byFirstWord: ReadonlyMap<string, readonly PhraseCandidate[]>;
}