让我们说我在IBM Watson中配置了一个会话服务,准备识别以单词和片段形式给出的数字。例如,如果我有号码1320
,则可以thirteen twenty
或thirteen two zero
等方式发送。
在第一种情况下,我会从对话服务中得到类似的内容:
{
// ...
"entities": [
{
"entity": "sys-number",
"location": [
0,
5
],
"value": "13",
"confidence": 1,
"metadata": {
"numeric_value": 13
}
},
{
"entity": "sys-number",
"location": [
6,
12
],
"value": "20",
"confidence": 1,
"metadata": {
"numeric_value": 20
}
}
]
// ...
}
在第二种情况下(thirteen two zero
):
{
// ...
"entities": [
{
"entity": "sys-number",
"location": [
0,
5
],
"value": "13",
"confidence": 1,
"metadata": {
"numeric_value": 13
}
},
{
"entity": "sys-number",
"location": [
6,
14
],
"value": "2",
"confidence": 1,
"metadata": {
"numeric_value": 2
}
}
]
// ...
}
这里最大的问题是:我的零在哪里?
我知道这个问题不止一次被问过,但我找到的答案都没有解决我当前的问题。 我已经看到了可以使用正则表达式的例子,但是对于实际数字,这里我有单词而Watson是实际猜测数字的人。
有没有办法在我的实体中获得该零的第三个条目?或另一项工作?或者我可能缺乏配置?
答案 0 :(得分:0)
我刚刚在Watson Assistant中尝试过此操作,现在它得到了零。启用@ sys-numbers后,我的发音为thirteen two zero
,我又得到了这些实体:
entities: [
0: {
entity: "sys-number",
location: [0, 8],
value: "13",
confidence: 1,
metadata: {numeric_value: 13}
}
1: {
entity: "sys-number",
location: [9, 12],
value: "2",
confidence: 1,
metadata: {numeric_value: 2}
}
2: {
entity: "sys-number",
location: [13, 17],
value: "0",
confidence: 1,
metadata: {numeric_value: 0}
}
]
可能是实体匹配得到了改善。