Skip to content

Commit

Permalink
演示获取单词与词性
Browse files Browse the repository at this point in the history
  • Loading branch information
hankcs committed Mar 23, 2018
1 parent fa24f2a commit ec67316
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
"商品和服务",
"结婚的和尚未结婚的确实在干扰分词啊",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_hanlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
"商品和服务",
"结婚的和尚未结婚的确实在干扰分词啊",
Expand Down

0 comments on commit ec67316

Please sign in to comment.