【问题标题】:Spacy Dutch noun_phrases returns empty list using nl_core_news_smSpacy Dutch noun_phrases 使用 nl_core_news_sm 返回空列表
【发布时间】:2020-06-11 16:09:53
【问题描述】:

我想使用 spacy 的模型 nl_core_news_sm 提取荷兰语文本的名词短语。 它返回一个空列表 另一方面,等效的英语模型 en_core_web_sm 确实提供了 noun_chunks (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)

在英语中它有效。

有什么想法吗?

编辑说明: 这里我比较了三种语言模型:

【问题讨论】:

  • 你能解决这个问题吗?我遇到了同样的问题,无法检索荷兰语文本的 noun_chunks

标签: spacy chunks language-model


【解决方案1】:

我可以告诉你,名词chuck tokenizer 根本还没有在荷兰语模型中实现。这不是一个错误。它只是必须完成。因此,阅读此内容的人请检查问题的日期。显然,spacy 家伙会这样做,但可能需要一段时间。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-18
    • 2021-03-11
    • 2015-10-27
    • 2014-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多