UNPKG

@predictive-text-studio/lexical-model-compiler

Version:
31 lines (30 loc) 1.25 kB
import { WordList, WordListSource } from "../wordlist"; /** * 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 createTrieDataStructureFromFilenames(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; /** * Given a real filesystem path, this implements the WordList source. */ export declare class WordListFromFilename implements WordListSource { readonly name: string; constructor(filename: string); lines(): Generator<import("../wordlist").LineNoAndText, void, unknown>; }