wechat-emoji-parser
Version:
22 lines (21 loc) • 519 B
TypeScript
/**
* 字符查找树
* @constructor
*/
declare class Trie {
tier: number;
matched: boolean;
wordsIndex: number;
children: {
[key in string]: Trie;
};
constructor(words?: string[]);
build(words: string[]): void;
insert(word: string, pos: number | undefined, wordsIndex: number): void;
searchOne(str: string, pos?: number): null | {
matchedPosition: [number, number];
tier: number;
};
search(str: string): [number, number][];
}
export default Trie;