UNPKG

965 BTypeScriptView Raw
1/**
2 * 标点符号识别模块
3 *
4 * @author 老雷<leizongmin@gmail.com>
5 */
6import { SubSModuleTokenizer } from '../mod';
7import { IWord } from '../Segment';
8export declare class PunctuationTokenizer extends SubSModuleTokenizer {
9 name: string;
10 _STOPWORD: string[];
11 STOPWORD: {
12 [key: string]: number;
13 };
14 STOPWORD2: {
15 [key: number]: {
16 [key: string]: number;
17 };
18 };
19 /**
20 * 对未识别的单词进行分词
21 *
22 * @param {array} words 单词数组
23 * @return {array}
24 */
25 split(words: IWord[]): IWord[];
26 /**
27 * 匹配包含的标点符号,返回相关信息
28 *
29 * @param {string} text 文本
30 * @param {int} cur 开始位置
31 * @return {array} 返回格式 {w: '网址', c: 开始位置}
32 */
33 matchStopword(text: string, cur?: number): IWord[];
34}
35export declare const init: typeof SubSModuleTokenizer.init;
36export default PunctuationTokenizer;