snipsco / snips-nlu

Snips Python library to extract meaning from text
https://snips-nlu.readthedocs.io
Apache License 2.0
3.9k stars 513 forks source link

+/plus is not taken into account in rawValue of snips/number entity #792

Closed koenvervloesem closed 5 years ago

koenvervloesem commented 5 years ago

What's the issue? While for a snips/number slot with value "-100" or "minus 100" the rawValue has the correct value, for "+100" or "plus 100" it hasn't: the +/plus is missing.

This happens consistently, as I discovered in my app Pick something random.

Use Cases Impacted In some cases, the + is important for clarity. For instance, when you're talking about temperature ranges, such as "from -40 to +75 degrees".

How to reproduce Install the app Pick something random.

Parse a sentence:

pi@snips:~ $ snips-nlu parse -t "pick a number between -100 and +100"
Loading model... loaded in 2515 ms
{
  "input": "pick a number between -100 and +100",
  "intent": {
    "intentName": "koan:RandomNumber",
    "confidenceScore": 1.0
  },
  "slots": [
    {
      "rawValue": "-100",
      "value": {
        "kind": "Number",
        "value": -100.0
      },
      "range": {
        "start": 22,
        "end": 26
      },
      "entity": "snips/number",
      "slotName": "min"
    },
    {
      "rawValue": "100",
      "value": {
        "kind": "Number",
        "value": 100.0
      },
      "range": {
        "start": 32,
        "end": 35
      },
      "entity": "snips/number",
      "slotName": "max"
    }
  ]
}
Elapsed: 28 ms

Expected behavior I would expect "rawValue" to be "+100" and "start" 31 for the max slot in this example:

pi@snips:~ $ snips-nlu parse -t "pick a number between -100 and +100"
Loading model... loaded in 2515 ms
{
  "input": "pick a number between -100 and +100",
  "intent": {
    "intentName": "koan:RandomNumber",
    "confidenceScore": 1.0
  },
  "slots": [
    {
      "rawValue": "-100",
      "value": {
        "kind": "Number",
        "value": -100.0
      },
      "range": {
        "start": 22,
        "end": 26
      },
      "entity": "snips/number",
      "slotName": "min"
    },
    {
      "rawValue": "+100",
      "value": {
        "kind": "Number",
        "value": 100.0
      },
      "range": {
        "start": 31,
        "end": 35
      },
      "entity": "snips/number",
      "slotName": "max"
    }
  ]
}
Elapsed: 28 ms

Version and Environment Snips Flow 1.1.2 (0.62.3), Raspbian 9.8, assistant with Pick something random installed.

adrienball commented 5 years ago

Hi @koenvervloesem , This is indeed an issue with the builtin entity parser not capturing the +, I've created an issue in the corresponding repository. Thanks for reporting.

adrienball commented 5 years ago

@koenvervloesem This should be fixed in snips-nlu>=0.20.0