【问题标题】:Use spaCy entities in Rasa-NLU training data在 Rasa-NLU 训练数据中使用 spaCy 实体
【发布时间】:2018-03-16 15:46:23
【问题描述】:

我正在尝试使用 Rasa 创建一个简单的程序,该程序从文本输入中提取(法国)街道地址。

按照 Rasa-NLU 文档 (http://rasa-nlu.readthedocs.io/en/latest/entities.html) 中的建议,我想使用 spaCy 进行地址检测。

我看到 (https://spacy.io/usage/training) 对应的 spaCy 预建实体将是 LOC

但是,我不明白如何使用该实体创建训练数据集。

这是我当前 JSON 训练数据集的摘录:

{
    "text" : "je vis au 2 Rue des Platanes",
    "intent" : "donner_adresse",
    "entities" : [
        {
            "start" : 10,
            "end" : 28,
            "value" : 2 Rue des Platanes",
            "entity" : "adresse"
        }
    ]
}

如果我训练程序并使用文本输入 "je vis au 2 Rue des Hetres" 运行它,我会得到以下输出:

{
    "entities": [
        "end": 26,
        "entity": "adresse",
        "extractor": "ner_crf",
        "start": 10,
        "value": "2 rue des hetres"
    ],
    "intent": null,
    "intent_ranking": [],
    "text": "je vis au 2 Rue des Hetres"
}

考虑到我的训练数据集,这很好。 但我想使用 spaCy 的 LOC 实体。

我怎样才能做到这一点? (我做错了什么?)

如果需要,这是我的配置文件的相关摘要:

{
    "pipeline" : "spacy_sklearn",
    "language" : "fr",
    "spacy_model_name" : "fr_core_news_md"
}

【问题讨论】:

    标签: spacy rasa-nlu


    【解决方案1】:

    如果您想使用 spaCy 的预训练 NER,您只需将其添加到您的管道中,例如

    pipeline = ["nlp_spacy", "tokenizer_spacy", "ner_spacy"]
    

    但根据您的需要,您可能只想复制preconfigured pipelines 之一并在末尾添加"ner_spacy"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-22
      • 1970-01-01
      • 1970-01-01
      • 2018-04-29
      • 1970-01-01
      相关资源
      最近更新 更多