在 Rasa-NLU 训练数据中使用 spaCy 实体
Use spaCy entities in Rasa-NLU training data
我正在尝试使用 Rasa 创建一个简单的程序,该程序从文本输入中提取(法国)街道地址。
根据Rasa-NLU doc (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 的 pre-trained NER,你只需要将它添加到你的管道中,例如
pipeline = ["nlp_spacy", "tokenizer_spacy", "ner_spacy"]
但根据您的需要,您可能只想复制其中一个 preconfigured pipelines 并在末尾添加 "ner_spacy"
我正在尝试使用 Rasa 创建一个简单的程序,该程序从文本输入中提取(法国)街道地址。
根据Rasa-NLU doc (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 的 pre-trained NER,你只需要将它添加到你的管道中,例如
pipeline = ["nlp_spacy", "tokenizer_spacy", "ner_spacy"]
但根据您的需要,您可能只想复制其中一个 preconfigured pipelines 并在末尾添加 "ner_spacy"