UNPKG

novel-segment

Version:

Chinese word segmentation 簡繁中文分词模块 以網路小說為樣本

33 lines (32 loc) 994 B
/** * 人名优化模块 * * @author 老雷<leizongmin@gmail.com> * @version 0.1 */ import { SubSModuleOptimizer } from '../mod'; import Segment, { IDICT, IWord } from '../Segment'; /** * @todo 支援 XX氏 */ export declare class ChsNameOptimizer extends SubSModuleOptimizer { protected _TABLE: IDICT<IWord>; name: string; _cache(): void; isMergeable2(...words: string[]): boolean; isMergeable(word: IWord, nextword: IWord): boolean; /** * 只有新詞屬於人名或未知詞時才會合併 */ validUnknownNewWord<W extends string | string[]>(ws: W, cb?: (nw: string, ew: IWord, ws: W) => IWord | boolean | void): true | Segment.IWord; /** * 对可能是人名的单词进行优化 * * @param {array} words 单词数组 * @return {array} */ doOptimize(words: IWord[]): IWord[]; } export declare const init: typeof SubSModuleOptimizer.init; export declare const type = "optimizer"; export default ChsNameOptimizer;