-
Notifications
You must be signed in to change notification settings - Fork 4
ontModel 说明文档
Junchao Wu edited this page May 16, 2022
·
3 revisions
- f_seg
正向最长匹配分词
>>> import qcnlp as qc
>>> text = "禁烟令人烦恼"
>>> f_list = qc.f_seg(text)
>>> print(f_list)
# ['禁烟令', '人', '烦恼']
- b_seg
逆向最长匹配分词
>>> import qcnlp as qc
>>> text = "禁烟令人烦恼"
>>> f_list = qc.b_seg(text)
>>> print(f_list)
# ['禁烟', '令人', '烦恼']
- l_seg
双向最长匹配分词
>>> import qcnlp as qc
>>> text = "禁烟令人烦恼"
>>> f_list = qc.l_seg(text)
>>> print(f_list)
# ['禁烟', '令人', '烦恼']
- sentence_seg
文本句子切分,将文本切分为若干句子,提供了coarse
或 fine
粗细两种句子切分粒度,
coarse
指的是按句号级别切分,fine
指按所有标点符合切分,默认按照粗粒度进行切分
>>> import qcnlp as qc
>>>text = "QCNLP,是一个小巧的NLP工具吧?是吧。"
>>>c_list = qc.sentence_seg(text,'coarse')
>>>f_list = qc.sentence_seg(text,'fine')
>>>print(c_list)
>>>print(f_list)
# ['QCNLP,是一个小巧的NLP工具吧?', '是吧。']
# ['QCNLP,', '是一个小巧的NLP工具吧?', '是吧。']