facebook / facebook/duckling

[EN] Month of May issues even when latent enabled

未关闭
#565 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Haskell
星标
4.3k
派生
740
PR 合并指标
30 天内没有已合并 PR

描述

I have identified a problem when using May in English results. Other issues (#521 #207) have touched on the problem, and according to https://github.com/facebook/duckling/issues/207#issuecomment-396779507 to use "May" you need to make sure to enable latent results for it to work properly.

I enabled latent results, but text containing May isn't being parsed correctly.

# Identifying the issue
**I have isolated the issue to May being defined as latent in https://github.com/facebook/duckling/blob/master/Duckling/Time/EN/Rules.hs#L1480.** If I change this line from
` , ( "May" , "may" , True )` to ` , ( "May" , "may" , False )` and recompile, all the examples below succeed.

I think the results I'm after should always be returned with `"latent": true`, and not need `Rules.hs` to be edited. I have not found why they're excluded; I expect tracking the cause down is beyond my non-existent knowledge of Haskell 😔

# How to reproduce & examples

## Compilation

I cloned this repository (as at commit 10eee56f10335bd9f9a969d5ae4684fc22c63599), uncommented lines 134-136 in https://github.com/facebook/duckling/blob/master/Duckling/Time/EN/Corpus.hs#L134-L136 and compiled under Ubuntu 18.04, using the supplied instructions. Stack used GHC 8.6.5.

## Execution
All examples were run against the supplied HTTP server with the following post data:
| Key | Value |
|--------|---------------|
| locale | en_GB |
| latent | true |
| dims | [] |
| tz | Europe/London |

## Examples
Examples come in pairs: an example that succeeds, and a modified one that contains May and fails.

### ✅ "January 2007"
```
[
{
"body": "January 2007",
"start": 0,
"value": {
"values": [
{
"value": "2007-01-01T00:00:00.000+00:00",
"grain": "month",
"type": "value"
}
],
"value": "2007-01-01T00:00:00.000+00:00",
"grain": "month",
"type": "value"
},
"end": 12,
"dim": "time",
"latent": false
}
]
```
### ❌ "May 2007"
```
[
{
"body": "May",
"start": 0,
"value": {
"values": [
{
"value": "2021-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
{
"value": "2022-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
{
"value": "2023-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
}
],
"value": "2021-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
"end": 3,
"dim": "time",
"latent": true
},
{
"body": "2007",
"start": 4,
"value": {
"value": 2007,
"type": "value",
"unit": "unknown"
},
"end": 8,
"dim": "amount-of-money",
"latent": true
},
{
"body": "2007",
"start": 4,
"value": {
"value": 2007,
"type": "value",
"unit": "unnamed"
},
"end": 8,
"dim": "quantity",
"latent": true
},
{
"body": "2007",
"start": 4,
"value": {
"value": 2007,
"type": "value"
},
"end": 8,
"dim": "number",
"latent": false
},
{
"body": "2007",
"start": 4,
"value": {
"values": [
{
"value": "2007-01-01T00:00:00.000+00:00",
"grain": "year",
"type": "value"
}
],
"value": "2007-01-01T00:00:00.000+00:00",
"grain": "year",
"type": "value"
},
"end": 8,
"dim": "time",
"latent": true
}
]
```

### ✅ "March to April 1965"
```
[
{
"body": "March to April 1965",
"start": 0,
"value": {
"values": [
{
"to": {
"value": "1965-05-01T00:00:00.000+01:00",
"grain": "month"
},
"from": {
"value": "1965-03-01T00:00:00.000+00:00",
"grain": "month"
},
"type": "interval"
}
],
"to": {
"value": "1965-05-01T00:00:00.000+01:00",
"grain": "month"
},
"from": {
"value": "1965-03-01T00:00:00.000+00:00",
"grain": "month"
},
"type": "interval"
},
"end": 19,
"dim": "time",
"latent": false
}
]
```
### ❌ "March to May 1965"
```
[
{
"body": "March",
"start": 0,
"value": {
"values": [
{
"value": "2021-03-01T00:00:00.000+00:00",
"grain": "month",
"type": "value"
},
{
"value": "2022-03-01T00:00:00.000+00:00",
"grain": "month",
"type": "value"
},
{
"value": "2023-03-01T00:00:00.000+00:00",
"grain": "month",
"type": "value"
}
],
"value": "2021-03-01T00:00:00.000+00:00",
"grain": "month",
"type": "value"
},
"end": 5,
"dim": "time",
"latent": false
},
{
"body": "May",
"start": 9,
"value": {
"values": [
{
"value": "2021-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
{
"value": "2022-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
{
"value": "2023-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
}
],
"value": "2021-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
"end": 12,
"dim": "time",
"latent": true
},
{
"body": "1965",
"start": 13,
"value": {
"value": 1965,
"type": "value",
"unit": "unknown"
},
"end": 17,
"dim": "amount-of-money",
"latent": true
},
{
"body": "1965",
"start": 13,
"value": {
"value": 1965,
"type": "value",
"unit": "unnamed"
},
"end": 17,
"dim": "quantity",
"latent": true
},
{
"body": "1965",
"start": 13,
"value": {
"value": 1965,
"type": "value"
},
"end": 17,
"dim": "number",
"latent": false
},
{
"body": "1965",
"start": 13,
"value": {
"values": [
{
"value": "1965-01-01T00:00:00.000+00:00",
"grain": "year",
"type": "value"
}
],
"value": "1965-01-01T00:00:00.000+00:00",
"grain": "year",
"type": "value"
},
"end": 17,
"dim": "time",
"latent": true
}
]
```

### ✅ "June 1973 to July 1976"
```
[
{
"body": "June 1973 to July 1976",
"start": 0,
"value": {
"values": [
{
"to": {
"value": "1976-08-01T00:00:00.000+01:00",
"grain": "month"
},
"from": {
"value": "1973-06-01T00:00:00.000+01:00",
"grain": "month"
},
"type": "interval"
}
],
"to": {
"value": "1976-08-01T00:00:00.000+01:00",
"grain": "month"
},
"from": {
"value": "1973-06-01T00:00:00.000+01:00",
"grain": "month"
},
"type": "interval"
},
"end": 22,
"dim": "time",
"latent": false
}
]
```
### ❌ "June 1973 to May 1976"
```
[
{
"body": "June 1973",
"start": 0,
"value": {
"values": [
{
"value": "1973-06-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
}
],
"value": "1973-06-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
"end": 9,
"dim": "time",
"latent": false
},
{
"body": "May",
"start": 13,
"value": {
"values": [
{
"value": "2021-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
{
"value": "2022-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
{
"value": "2023-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
}
],
"value": "2021-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
"end": 16,
"dim": "time",
"latent": true
},
{
"body": "1976",
"start": 17,
"value": {
"value": 1976,
"type": "value",
"unit": "unknown"
},
"end": 21,
"dim": "amount-of-money",
"latent": true
},
{
"body": "1976",
"start": 17,
"value": {
"value": 1976,
"type": "value",
"unit": "unnamed"
},
"end": 21,
"dim": "quantity",
"latent": true
},
{
"body": "1976",
"start": 17,
"value": {
"value": 1976,
"type": "value"
},
"end": 21,
"dim": "number",
"latent": false
},
{
"body": "1976",
"start": 17,
"value": {
"values": [
{
"value": "1976-01-01T00:00:00.000+00:00",
"grain": "year",
"type": "value"
}
],
"value": "1976-01-01T00:00:00.000+00:00",
"grain": "year",
"type": "value"
},
"end": 21,
"dim": "time",
"latent": true
}
]
```
### ✅ "Between April 1973 and June 1976"
```
[
{
"body": "Between April 1973 and June 1976",
"start": 0,
"value": {
"values": [
{
"to": {
"value": "1976-07-01T00:00:00.000+01:00",
"grain": "month"
},
"from": {
"value": "1973-04-01T00:00:00.000+01:00",
"grain": "month"
},
"type": "interval"
}
],
"to": {
"value": "1976-07-01T00:00:00.000+01:00",
"grain": "month"
},
"from": {
"value": "1973-04-01T00:00:00.000+01:00",
"grain": "month"
},
"type": "interval"
},
"end": 32,
"dim": "time",
"latent": false
}
]
```
### ❌ "Between May 1973 and June 1976"
```
[
{
"body": "May",
"start": 8,
"value": {
"values": [
{
"value": "2021-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
{
"value": "2022-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
{
"value": "2023-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
}
],
"value": "2021-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
"end": 11,
"dim": "time",
"latent": true
},
{
"body": "1973",
"start": 12,
"value": {
"value": 1973,
"type": "value",
"unit": "unknown"
},
"end": 16,
"dim": "amount-of-money",
"latent": true
},
{
"body": "1973",
"start": 12,
"value": {
"value": 1973,
"type": "value",
"unit": "unnamed"
},
"end": 16,
"dim": "quantity",
"latent": true
},
{
"body": "1973",
"start": 12,
"value": {
"value": 1973,
"type": "value"
},
"end": 16,
"dim": "number",
"latent": false
},
{
"body": "1973",
"start": 12,
"value": {
"values": [
{
"value": "1973-01-01T00:00:00.000+00:00",
"grain": "year",
"type": "value"
}
],
"value": "1973-01-01T00:00:00.000+00:00",
"grain": "year",
"type": "value"
},
"end": 16,
"dim": "time",
"latent": true
},
{
"body": "June 1976",
"start": 21,
"value": {
"values": [
{
"value": "1976-06-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
}
],
"value": "1976-06-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
"end": 30,
"dim": "time",
"latent": false
}
]
```
### ✅ "June 1973 to April 1976"
```
[
{
"body": "June 1973 to April 1976",
"start": 0,
"value": {
"values": [
{
"to": {
"value": "1976-05-01T00:00:00.000+01:00",
"grain": "month"
},
"from": {
"value": "1973-06-01T00:00:00.000+01:00",
"grain": "month"
},
"type": "interval"
}
],
"to": {
"value": "1976-05-01T00:00:00.000+01:00",
"grain": "month"
},
"from": {
"value": "1973-06-01T00:00:00.000+01:00",
"grain": "month"
},
"type": "interval"
},
"end": 23,
"dim": "time",
"latent": false
}
]
```
### ❌ "January 1973 to May 1976"
```
[
{
"body": "January 1973",
"start": 0,
"value": {
"values": [
{
"value": "1973-01-01T00:00:00.000+00:00",
"grain": "month",
"type": "value"
}
],
"value": "1973-01-01T00:00:00.000+00:00",
"grain": "month",
"type": "value"
},
"end": 12,
"dim": "time",
"latent": false
},
{
"body": "May",
"start": 16,
"value": {
"values": [
{
"value": "2021-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
{
"value": "2022-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
{
"value": "2023-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
}
],
"value": "2021-05-01T00:00:00.000+01:00",
"grain": "month",
"type": "value"
},
"end": 19,
"dim": "time",
"latent": true
},
{
"body": "1976",
"start": 20,
"value": {
"value": 1976,
"type": "value",
"unit": "unknown"
},
"end": 24,
"dim": "amount-of-money",
"latent": true
},
{
"body": "1976",
"start": 20,
"value": {
"value": 1976,
"type": "value",
"unit": "unnamed"
},
"end": 24,
"dim": "quantity",
"latent": true
},
{
"body": "1976",
"start": 20,
"value": {
"value": 1976,
"type": "value"
},
"end": 24,
"dim": "number",
"latent": false
},
{
"body": "1976",
"start": 20,
"value": {
"values": [
{
"value": "1976-01-01T00:00:00.000+00:00",
"grain": "year",
"type": "value"
}
],
"value": "1976-01-01T00:00:00.000+00:00",
"grain": "year",
"type": "value"
},
"end": 24,
"dim": "time",
"latent": true
}
]
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。