0

wit is trained to extract wit/number and wit/amountOfMoney it correctly interprets following sentences as 3.03 pounds: 1)Spent 3 pound and 3 pence 2) Spent 3 cent 3) spent £3:

but fails for : 1) spent 3 pence 2) spent 3p

Questions: 1) It this a bug/ new feature ? 2) Is there a workaround ? Reference : https://en.wikipedia.org/wiki/Pound_sterling WIT.AI API Response for spent 3 pounds and 3 cent

{
      "msg_id": "XXXXXXXXXXXXXXXXXXX",
      "_text": "spent 3 pounds and 3 cent",
      "entities": {
        "amount_of_money": [
          {
            "_body": "3 pounds and 3 cent",
            "confidence": 1,
            "_start": 6,
            "_end": 25,
            "_entity": "amount_of_money",
            "type": "value",
            "value": 3.03,
            "unit": "£"
          }
        ],
        "intent": [
          {
            "confidence": 0.9873680621152465,
            "_entity": "intent",
            "value": "expense"
          }
        ]
      }
    }

WIT.AI API Response for "Spent 3p" :

{
  "msg_id": "XXXXXXXXXXXXXXXXXXX",
  "_text": "spent 3p",
  "entities": {
    "number": [
      {
        "_body": "3",
        "confidence": 1,
        "_start": 6,
        "_end": 7,
        "_entity": "number",
        "type": "value",
        "value": 3
      }
    ],
    "intent": [
      {
        "confidence": 0.9928105550766221,
        "_entity": "intent",
        "value": "expense"
      }
    ]
  }
}
Wit user
  • 1
  • 1

1 Answers1

1

The wit/number and wit/amount-of-money entities rely on Duckling for parsing.

Here are the rules defining amounts of money for English: https://github.com/wit-ai/duckling/blob/master/resources/languages/en/rules/finance.clj

As you can see, there is no rule for "pence" nor "p". Duckling being open source, you can contribute and do a pull request.

patapizza
  • 2,398
  • 15
  • 14