diff --git a/README.md b/README.md index 80c84ef..060720c 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,8 @@ $ hanlp parse <<< '徐先生还具体帮助他确定了把画雄鹰、松鼠和 from pyhanlp import * print(HanLP.segment('你好,欢迎在Python中调用HanLP的API')) +for term in HanLP.segment('下雨天地面积水'): + print('{}\t{}'.format(term.word, term.nature)) # 获取单词与词性 testCases = [ "商品和服务", "结婚的和尚未结婚的确实在干扰分词啊", diff --git a/tests/test_hanlp.py b/tests/test_hanlp.py index 00bf121..17f0fda 100644 --- a/tests/test_hanlp.py +++ b/tests/test_hanlp.py @@ -74,6 +74,8 @@ def test_analyze(self): def test_segment(self): logging.info("test_segment") print(HanLP.segment('你好,欢迎在Python中调用HanLP的API')) + for term in HanLP.segment('下雨天地面积水'): + print('{}\t{}'.format(term.word, term.nature)) # 获取单词与词性 testCases = [ "商品和服务", "结婚的和尚未结婚的确实在干扰分词啊",