from bosonnlp import BosonNLP
file_object2=open('D:\A仲敏2015\python_code\\企业名实体匹配.txt').read().split('\n') #一行行的读取内容
nlp = BosonNLP('fSflwaQA.15494.d29JM3-a40Nn')#官网http://bosonnlp.com/注册账号,获取YOUR_API_TOKEN值:'fSflwaQA.15494.d29JM3-a40Nn'
for line in file_object2:
result = nlp.ner(line)[0]
words = result['word']
entities = result['entity']
for entity in entities:
print([''.join(words[entity[0]:entity[1]]), entity[2]])
命名体识别
最新推荐文章于 2024-10-26 17:58:54 发布