@predictive-text-studio/lexical-model-compiler
Version:
Keyman Developer lexical model compiler
28 lines (27 loc) • 1.44 kB
TypeScript
import { WordList, WordListSource } from "./wordlist";
/**
* Reads a tab-separated values file into a word list. This function converts all
* entries into NFC and merges duplicate entries across wordlists. Duplication is
* on the basis of character-for-character equality after normalisation to NFC.
*
* Format specification:
*
* - the file is a UTF-8 encoded text file.
* - new lines are either LF or CRLF.
* - the file MAY start with the UTF-8 byte-order mark (BOM); that is, if the
* first three bytes of the file are EF BB BF, these will be interepreted as
* the BOM and will be ignored.
* - the file either consists of a comment or an entry.
* - comment lines MUST start with the '#' character on the very first column.
* - entries are one to three columns, separated by the (horizontal) tab
* character.
* - column 1 (REQUIRED): the wordform: can have any character except tab, CR,
* LF. Surrounding whitespace characters are trimmed.
* - column 2 (optional): the count: a non-negative integer specifying how many
* times this entry has appeared in the corpus. Blank means 'indeterminate'.
* - column 3 (optional): comment: an informative comment, ignored by the tool.
*
* @param wordlist word list to merge entries into (may have existing entries)
* @param contents contents of the file to import
*/
export declare function parseWordList(wordlist: WordList, source: WordListSource): void;