# coding=utf-8
import json
import logging
from stanfordcorenlp import StanfordCoreNLP
# nlp_entity = StanfordCoreNLP(r'stanford-corenlp-full-2018-02-27', lang='zh', quiet=False, logging_level=logging.DEBUG)
def combineByNer(nerType, tokens):
# find all first indexes of series of tokens tagged as PERSON
num_tokens = len(tokens)
result = []
first_indexes = (i for i in range(num_tokens) if tokens[i]['ner'] == nerType and (i == 0 or tokens[i-1]['ner'] != nerType))
for begin_index in first_indexes:
实体识别(corenlp)
最新推荐文章于 2023-05-12 09:24:54 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)