/tfseg

Primary LanguageJupyter NotebookMIT LicenseMIT

Chinese Word Segmentation with TensorFlow

solution: Albert + CRF

接口类似jieba

安装:pip install tfseg

分词:

>>> import tfseg
>>> tfseg.lcut('我爱北京***')
['我', '爱', '北京', '***']

词性:

>>> from tfseg import posseg
>>> posseg.lcut('我爱北京***')
[pair('我', 'r'), pair('爱', 'v'), pair('北京', 'ns'), pair('***', 'ns')]
>>> posseg.lcut('我爱北京***')[0].word
'我'
>>> posseg.lcut('我爱北京***')[0].flag
'r'