问题描述
<style lang="sass" scoped>
import '@/assets/sass/styles.sass'
/* wrapper is Now recognized */
#wrapper
...
import spacy
from spacy_lookup import Entity
data = {0:["count"],1:["unique count","unique"]}
def processtext(text):
nlp = spacy.blank('en')
for i,arr in data.items():
fLabel = "test:"+str(i)
fEntitty = Entity(keywords_list=list(set(arr)),label=fLabel)
fEntitty.name = fLabel
nlp.add_pipe(fEntitty)
match_doc = nlp(text)
print(match_doc.ents)
processtext("unique count of city")
不仅这种情况,而且人名也一样,例如Karthik vs Karthik reddy,Jon vs Jon Allen 谁能帮我解决这个问题。
提前谢谢!
解决方法
在spaCy中,命名实体永远不能重叠。如果“乔恩·艾伦”是一个名字,那么您也不应将“约翰”注释为一个名字。因此,在培训之前,您必须解决这些重叠/冲突的情况。
讨论后在评论中进行编辑:
您将需要实现一个on_match
函数,以过滤出与非重叠集合的匹配项。