我想使用nl_core_news_sm by spacy模型提取荷兰语文本的noun_phrases。它返回一个空列表,而等效的英语模型en_core_web_sm确实提供了noun_chunks (noun_phrases)的列表。
这是正常行为吗?也就是说,荷兰语模型不包含noun_phrases分隔符,而英语模型包含?还是我做错了什么?
string='''In een wereld waarin je wordt overspoeld met informatie, is het prettig om een nieuwsbron te hebben met heldere stukken, die de ruimte laten om je eigen mening te vormen.'''
nlp = spacy.load('nl_core_news_sm')
print(dir(doc))
print(doc.noun_chunks)
list_chunks=[chunk for chunk in doc.noun_chunks]
for chunk in doc.noun_chunks:
print(chunk.text)这里的结果是list_chunks是[],当然不会在循环中打印任何内容
我使用dir(doc)来比较可用的方法,以便与英语模型进行比较。它们是一样的。
nlp_en = spacy.load('en_core_web_sm')
string='''They normally organises a wide range of activities for kids in the summer holidays. Due to the virus, these have all been cancelled'''
doc2=nlp_en(string)
print(dir(doc2))
print(doc2.noun_chunks)
for chunk in doc2.noun_chunks:
print(chunk.text)在英语中,它是有效的。
有什么想法吗?
编者按:这里我比较了三种语言模型:

发布于 2020-08-09 14:49:05
我可以告诉您,名词chuck标记器在荷兰语模型中还没有实现。这不是个bug。这是必须要做的。所以,无论谁读了这篇文章,请检查问题的日期。显然spacy的人会这么做,但这可能需要一段时间。
https://stackoverflow.com/questions/62328660
复制相似问题