How to use the cspell-trie-lib.importTrie function in cspell-trie-lib

To help you get started, we’ve selected a few cspell-trie-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github streetsidesoftware / cspell / packages / cspell-lib / src / SpellingDictionary / SpellingDictionary.ts View on Github external
export async function createSpellingDictionaryTrie(
    data: IterableLike,
    name: string,
    source: string,
    options?: SpellingDictionaryOptions
): Promise {
    const trieNode = importTrie(data);
    const trie = new Trie(trieNode);
    return new SpellingDictionaryFromTrie(trie, name, options, source);
}
github streetsidesoftware / cspell / packages / cspell-trie / src / app.ts View on Github external
.action(async (filename, options) => {
        const {
            output: outputFile,
        } = options;
        notify('Reading Trie', !!outputFile);
        const pOutputStream = createWriteStream(outputFile);
        const lines = await fileToLines(filename);
        const root = Trie.importTrie(lines);
        const words = Trie.iteratorTrieWords(root);
        const outputStream = await pOutputStream;
        return new Promise((resolve) => {
            iterableToStream(words.map(a => a + '\n')).pipe(outputStream).on('finish', () => resolve());
        });
    });