Options
All
  • Public
  • Public/Protected
  • All
Menu

字典识别模块

author

老雷leizongmin@gmail.com

Hierarchy

  • any
    • DictTokenizer

Index

Type aliases

Static IAssessRow

IAssessRow: object

使用类似于MMSG的分词算法 找出所有分词可能,主要根据一下几项来评价:

x、词数量最少; a、词平均频率最大; b、每个词长度标准差最小; c、未识别词最少; d、符合语法结构项:如两个连续的动词减分,数词后面跟量词加分;

取以上几项综合排名最最好的

Type declaration

  • a: number

    词总频率,越大越好

  • b: number

    词标准差,越小越好 每个词长度标准差最小

  • c: number

    未识别词,越小越好

  • d: number

    符合语法结构程度,越大越好 符合语法结构项:如两个连续的动词减分,数词后面跟量词加分

  • Optional index?: number
  • Optional score?: number

    結算評分(自動計算)

  • x: number

    词数量,越小越好

Properties

MAX_CHUNK_COUNT

MAX_CHUNK_COUNT: number = DEFAULT_MAX_CHUNK_COUNT

防止因無分段導致分析過久甚至超過處理負荷 越高越精準但是處理時間會加倍成長甚至超過記憶體能處理的程度

數字越小越快

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

type

{number}

Protected _TABLE

_TABLE: IDICT<IWord>

Protected _TABLE2

_TABLE2: IDICT2<IWord>

Methods

_cache

  • _cache(): void

Protected filterWord

getChunks

  • getChunks(wordpos: object, pos: number, text?: string, total_count?: number): IWord[][]
  • 取所有分支

    Parameters

    • wordpos: object
      • [index: number]: IWord[]
    • pos: number

      当前位置

    • Optional text: string

      本节要分词的文本

    • Default value total_count: number = 0

    Returns IWord[][]

getPosInfo

  • getPosInfo(words: IWord[], text: string): object

getTops

Protected matchWord

  • matchWord(text: string, cur: number, preword: IWord): IWord[]
  • 匹配单词,返回相关信息

    Parameters

    • text: string

      文本

    • cur: number

      开始位置

    • preword: IWord

      上一个单词

    Returns IWord[]

    返回格式 {w: '单词', c: 开始位置}

split

Generated using TypeDoc