UNPKG

@odict/opencc-js

Version:

The JavaScript version of Open Chinese Convert (OpenCC)

31 lines (29 loc) 825 B
interface TrieMap extends Map<number, TrieMap> { trie_val?: string; } declare class Trie { map: TrieMap; constructor(); /** * Add a word to the trie * @param sourceText The string to match * @param replacementText The string to replace with */ addWord(sourceText: string, replacementText: string): void; /** * Load a JSON dictionary (Record<string, string>) * @param dict JSON dictionary */ loadDict(dict: Record<string, string>): void; /** * Load multiple JSON dictionaries * @param dicts Array of JSON dictionaries */ loadDictGroup(dicts: Record<string, string>[]): void; /** * Convert a string using the trie * @param inputString The string to convert */ convert(inputString: string): string; } export { Trie };