UNPKG

@keymanapp/kmc-model

Version:

Keyman Developer lexical model compiler

40 lines 1.59 kB
/** * A word list is (conceptually) an array of pairs: the concrete word form itself + a * non-negative count. * * Since each word should only appear once within the list, we represent it with * an associative array pattern keyed by the wordform. */ export type WordList = { [wordform: string]: number; }; /** * Returns a data structure that can be loaded by the TrieModel. * * It implements a **weighted** trie, whose indices (paths down the trie) are * generated by a search key, and not concrete wordforms themselves. * * @param sourceFiles an array of source files that will be read to generate the trie. */ export declare function createTrieDataStructure(filenames: string[], searchTermToKey?: (wf: string) => string): string; /** * Parses a word list from a file, merging duplicate entries. * * The word list may be encoded in: * * - UTF-8, with or without BOM [exported by most software] * - UTF-16, little endian, with BOM [exported by Microsoft Excel] * * @param wordlist word list to merge entries into (may have existing entries) * @param filename filename of the word list */ export declare function parseWordListFromFilename(wordlist: WordList, filename: string): void; /** * Parses a word list from a string. The string should have multiple lines * with LF or CRLF line terminators. * * @param wordlist word list to merge entries into (may have existing entries) * @param filename filename of the word list */ export declare function parseWordListFromContents(wordlist: WordList, contents: string): void; //# sourceMappingURL=build-trie.d.ts.map