UNPKG

1.14 kBTypeScriptView Raw
1/**
2 * 通配符识别模块
3 *
4 * @author 老雷<leizongmin@gmail.com>
5 */
6import { SubSModuleTokenizer, ISubTokenizerCreate } from '../mod';
7import { Segment, IWord, IDICT, IDICT2 } from '../Segment';
8import { IWordDebugInfo } from '../util/index';
9export declare class WildcardTokenizer extends SubSModuleTokenizer {
10 name: string;
11 protected _TABLE: IDICT<IWord>;
12 protected _TABLE2: IDICT2<IWord>;
13 _cache(): void;
14 /**
15 * 对未识别的单词进行分词
16 *
17 * @param {array} words 单词数组
18 * @return {array}
19 */
20 split(words: IWord[]): IWord[];
21 createWildcardToken(word: IWord, lasttype?: number, attr?: IWordDebugInfo): Segment.IWord;
22 splitWildcard(text: string, cur?: number): IWord[];
23 /**
24 * 匹配单词,返回相关信息
25 *
26 * @param {string} text 文本
27 * @param {int} cur 开始位置
28 * @return {array} 返回格式 {w: '单词', c: 开始位置}
29 */
30 matchWord(text: string, cur?: number): Segment.IWord[];
31}
32export declare const init: ISubTokenizerCreate<WildcardTokenizer, SubSModuleTokenizer>;
33export default WildcardTokenizer;