如何使用非相邻词的RASA NLU提取实体
how to extract entity with RASA NLU which are not adjacent words
https://github.com/RasaHQ/rasa_nlu/issues/1468#issue-370187480
Rasa NLU 版本:0.13.6
操作系统(windows、osx、...):windows
模型配置文件内容:
yml
language: "en"
pipeline:
- name: tokenizer_whitespace
- name: intent_entity_featurizer_regex
- name: ner_crf
- name: ner_synonyms
- name: intent_featurizer_count_vectors
- name: intent_classifier_tensorflow_embedding
intent_tokenization_flag: true
intent_split_symbol: "+"
path: ./models/nlu
data: ./data/training_nlu.json
问题:
如何提取实体。这不是相邻的词。下面是一个例子:
我需要训练我的 NLU 来理解 public 不满,比如街灯熄灭、街上坑坑洼洼、白天路灯亮起[=13=]
我的实体值为 STREET LIGHT OUT ,这意味着有人想报告路灯不工作。
he/she 将按以下格式执行。
班加罗尔 42 号 Ulsoor 路 WH Hanumanthappa 布局 Vasanth Shetty 医生诊所附近的 路灯 已经 融合 一个星期以来.
街灯单独不是一个实体或者融合单独不是我的实体。
street light fused 是同义词。
是否有可能训练 NLU 从这句话中提取融合的路灯。如果是如何。
如果否,拆分 Street Light 并融合为不同的实体是唯一的解决方案吗?
但是从上面的句子中提取 street light fused 是可能的,因为它可以提取其中包含多个单词的实体,而 tokenizer_whitespace 只是在白色 space 处中断。
请建议是否有更好的方法来获取我的实体而不拆分为多个实体。
这里我有更多关于同一问题的例子:
示例 1:
过去 10 天未清理的垃圾,需要立即注意清理。
这里我可以挑出来没有捡到的垃圾是问题所在。我可以训练我的 NLU 使用 ner_crf 和下面的训练片段来提取这个命名实体
{
"text": "Garbage not picked from past 10 days,need immediate attention for clearance",
"intent": "inform_grevience",
"entities": [
{
"start": 20,
"end": 38,
"value": "Garbage not picked",
"entity": "issue"
}
]
}
示例 2:
第 10 号主干附近的一个 垃圾 垃圾箱在过去 10 天里未被拾取,需要立即采取行动
不同的公民报告相同的问题但不同的句子。
我可以使用 ner_crf 提取未从示例 2 中提取的垃圾吗?
我将提出两种替代方法,两者都依赖于意图。我相信您提供的话语中唯一的实体是地址信息。
因此您可以将每个示例训练为完全不同的意图(不包括实体):
## intent:streetLightOut
- The Street light adjacent to Dr Vasanth Shetty's Clinic , WH Hanumanthappa Layout, Ulsoor Road, Bangalore 42 is out.
- I'd like to report a street light that is burnt out
- street light out
## intent:streetLightAlwaysOn
- The Street light adjacent to Dr Vasanth Shetty's Clinic , WH Hanumanthappa Layout, Ulsoor Road, Bangalore 42 is always on.
- I'd like to report a street light that never turns off
- street light on constantly
## intent:potholeInStreet
- There's a pothole at the intersection of 10th and main
- pothole
- pothole on 11th street near Wal-Mart
或者,由于您使用的是张量流,因此您可以使用继承意图:
## intent:streetLight+out
- The Street light adjacent to Dr Vasanth Shetty's Clinic , WH Hanumanthappa Layout, Ulsoor Road, Bangalore 42 is out.
- I'd like to report a street light that is burnt out
- street light out
## intent:streetLight+alwaysOn
- The Street light adjacent to Dr Vasanth Shetty's Clinic , WH Hanumanthappa Layout, Ulsoor Road, Bangalore 42 is always on.
- I'd like to report a street light that never turns off
- street light on constantly
## intent:potHole
- There's a pothole at the intersection of 10th and main
- pothole
- pothole on 11th street near Wal-Mart
我建议这些方法的主要原因是 Rasa 中的实体具有高度的位置性,对单词的重要性很小(并且不包含单词向量)。由于路灯的所有问题都可能包含这些词或类似词,因此该词本身似乎最有价值。
此博客 post 有一些关于 TensforFlow 和分层意图的信息:https://medium.com/rasa-blog/supervised-word-vectors-from-scratch-in-rasa-nlu-6daf794efcd8
https://github.com/RasaHQ/rasa_nlu/issues/1468#issue-370187480
Rasa NLU 版本:0.13.6
操作系统(windows、osx、...):windows
模型配置文件内容: yml
language: "en"
pipeline:
- name: tokenizer_whitespace
- name: intent_entity_featurizer_regex
- name: ner_crf
- name: ner_synonyms
- name: intent_featurizer_count_vectors
- name: intent_classifier_tensorflow_embedding
intent_tokenization_flag: true
intent_split_symbol: "+"
path: ./models/nlu
data: ./data/training_nlu.json
问题:
如何提取实体。这不是相邻的词。下面是一个例子:
我需要训练我的 NLU 来理解 public 不满,比如街灯熄灭、街上坑坑洼洼、白天路灯亮起[=13=]
我的实体值为 STREET LIGHT OUT ,这意味着有人想报告路灯不工作。 he/she 将按以下格式执行。
班加罗尔 42 号 Ulsoor 路 WH Hanumanthappa 布局 Vasanth Shetty 医生诊所附近的 路灯 已经 融合 一个星期以来.
街灯单独不是一个实体或者融合单独不是我的实体。 street light fused 是同义词。 是否有可能训练 NLU 从这句话中提取融合的路灯。如果是如何。
如果否,拆分 Street Light 并融合为不同的实体是唯一的解决方案吗? 但是从上面的句子中提取 street light fused 是可能的,因为它可以提取其中包含多个单词的实体,而 tokenizer_whitespace 只是在白色 space 处中断。
请建议是否有更好的方法来获取我的实体而不拆分为多个实体。
这里我有更多关于同一问题的例子:
示例 1:
过去 10 天未清理的垃圾,需要立即注意清理。
这里我可以挑出来没有捡到的垃圾是问题所在。我可以训练我的 NLU 使用 ner_crf 和下面的训练片段来提取这个命名实体
{
"text": "Garbage not picked from past 10 days,need immediate attention for clearance",
"intent": "inform_grevience",
"entities": [
{
"start": 20,
"end": 38,
"value": "Garbage not picked",
"entity": "issue"
}
]
}
示例 2:
第 10 号主干附近的一个 垃圾 垃圾箱在过去 10 天里未被拾取,需要立即采取行动
不同的公民报告相同的问题但不同的句子。
我可以使用 ner_crf 提取未从示例 2 中提取的垃圾吗?
我将提出两种替代方法,两者都依赖于意图。我相信您提供的话语中唯一的实体是地址信息。
因此您可以将每个示例训练为完全不同的意图(不包括实体):
## intent:streetLightOut
- The Street light adjacent to Dr Vasanth Shetty's Clinic , WH Hanumanthappa Layout, Ulsoor Road, Bangalore 42 is out.
- I'd like to report a street light that is burnt out
- street light out
## intent:streetLightAlwaysOn
- The Street light adjacent to Dr Vasanth Shetty's Clinic , WH Hanumanthappa Layout, Ulsoor Road, Bangalore 42 is always on.
- I'd like to report a street light that never turns off
- street light on constantly
## intent:potholeInStreet
- There's a pothole at the intersection of 10th and main
- pothole
- pothole on 11th street near Wal-Mart
或者,由于您使用的是张量流,因此您可以使用继承意图:
## intent:streetLight+out
- The Street light adjacent to Dr Vasanth Shetty's Clinic , WH Hanumanthappa Layout, Ulsoor Road, Bangalore 42 is out.
- I'd like to report a street light that is burnt out
- street light out
## intent:streetLight+alwaysOn
- The Street light adjacent to Dr Vasanth Shetty's Clinic , WH Hanumanthappa Layout, Ulsoor Road, Bangalore 42 is always on.
- I'd like to report a street light that never turns off
- street light on constantly
## intent:potHole
- There's a pothole at the intersection of 10th and main
- pothole
- pothole on 11th street near Wal-Mart
我建议这些方法的主要原因是 Rasa 中的实体具有高度的位置性,对单词的重要性很小(并且不包含单词向量)。由于路灯的所有问题都可能包含这些词或类似词,因此该词本身似乎最有价值。
此博客 post 有一些关于 TensforFlow 和分层意图的信息:https://medium.com/rasa-blog/supervised-word-vectors-from-scratch-in-rasa-nlu-6daf794efcd8