深度学习 / 自然语言 · 2月 19, 2022 0

甲骨自然语言工具包

内容纲要

甲骨自然语言工具包

https://github.com/ownthink/Jiagu

pip install -U jiagu
Collecting jiagu
  Downloading jiagu-0.2.3.tar.gz (53.8 MB)
[K     |████████████████████████████████| 53.8 MB 212 kB/s 
[?25hBuilding wheels for collected packages: jiagu
  Building wheel for jiagu (setup.py) ... [?25l[?25hdone
  Created wheel for jiagu: filename=jiagu-0.2.3-py3-none-any.whl size=53824961 sha256=827933140030ca05729083d8ab31cb5043a23b5bda8d48dcbf2b4c705393f649
  Stored in directory: /root/.cache/pip/wheels/bd/c4/27/fb46d4c229b4e84e7ff63b7c9853808c48e42f2d3e20a41361
Successfully built jiagu
Installing collected packages: jiagu
Successfully installed jiagu-0.2.3

分词,词性标注,命名实体

import jiagu

#jiagu.init() # 可手动初始化,也可以动态初始化

text = '位于厦门的小米公司明天会不会下雨'

words = jiagu.seg(text) # 分词
print(words)

pos = jiagu.pos(words) # 词性标注
print(pos)

ner = jiagu.ner(words) # 命名实体识别
print(ner)
['位于', '厦门', '的', '小米', '公司', '明天', '会不会', '下雨']
['v', 'ns', 'u', 'n', 'n', 'nt', 'v', 'v']
['O', 'B-LOC', 'O', 'B-LOC', 'I-ORG', 'O', 'O', 'O']
%d 博主赞过: