wit icon indicating copy to clipboard operation
wit copied to clipboard

Keyword matching matches first part of keyword that makes up larger keyword

Open maxim-isakov-ross opened this issue 9 years ago • 8 comments

Do you want to request a feature, report a bug, or ask a question about wit?

bug

What is the current behavior?

Let's say I have an entity that has keywords/synonyms: M.D., N.C., M.D.N.C, amongst others, which are all mean different things. If I provide an input such as:

"I really like the M.D.N.C." the keywords retrieved are M.D. and N.C.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

I have keyword matching on and if you were to use the sentence I provided on my application you will find the same incorrect results.

What is the expected behavior?

The expected output of the sentence that I provided would be the extraction of M.D.N.C. as a keyword, not the 2 keywords that were actually extracted.

What is the App ID where you are experiencing this issue (if applicable)?

594bfa3f-42d2-4d9d-9ec6-f6a41f60bfdc

maxim-isakov-ross avatar Nov 27 '17 19:11 maxim-isakov-ross

Hey @maximFromThe6ix Testing your app, shows the correct entity is matched (jurisdiction, with the entity value that has the keyword M.D.N.C.

What are the entities that you are seeing on your end?

stopachka avatar Dec 04 '17 02:12 stopachka

With this query:

"In M.D.N.C., is the color of the sky blue?"

I'm getting 2 entities, rather than just the 1

maxim-isakov-ross avatar Dec 04 '17 13:12 maxim-isakov-ross

This is still happening, is there really no fix?

maxim-isakov-ross avatar Dec 21 '17 15:12 maxim-isakov-ross

Hi @stopachka

We have seen the same issue for months with our system. It's been easy enough to patch over in our backing code, but I would assume that the longest matching substring be chosen for the entity, instead of the smallest matching ones.

Anyways, in case there's a chance this will be resolved, I have created a new wit.ai App to showcase the bug.

App Id: 5a4c08da-41d2-4f1b-8528-6ff03ab3b4df

image image

The issue occurs with free text & keywords as well as just keywords as the lookup strategy.

yegeniy avatar Jan 02 '18 22:01 yegeniy

Thanks for your feedback, we're looking into it

blandinw avatar Jan 08 '18 18:01 blandinw

This is now fixed, thank you for your feedback and patience.

blandinw avatar Feb 08 '18 16:02 blandinw

This is glorious! Confirmed as working, wonderfully.

{
  "_text": "al east",
  "entities": {
    "organization": [
      {
        "confidence": 1,
        "value": "American League",
        "type": "value",
        "_entity": "organization",
        "_body": "al",
        "_start": 0,
        "_end": 2
      },
      {
        "confidence": 1,
        "value": "East",
        "type": "value",
        "_entity": "organization",
        "_body": "east",
        "_start": 3,
        "_end": 7
      }
    ]
  },
  "msg_id": "localtesting.1518109316"
}
{
  "_text": "national league",
  "entities": {
    "organization": [
      {
        "confidence": 1,
        "value": "National League",
        "type": "value",
        "_entity": "organization",
        "_body": "national league",
        "_start": 0,
        "_end": 15
      }
    ]
  },
  "msg_id": "localtesting.1518109316"
}
{
  "_text": "all-stars game",
  "entities": {
    "organization": [
      {
        "confidence": 1,
        "value": "All-Star Game",
        "type": "value",
        "_entity": "organization",
        "_body": "all-stars game",
        "_start": 0,
        "_end": 14
      }
    ],
    "intent": [
      {
        "confidence": 0.73611579188875,
        "value": "gameinfo",
        "_entity": "intent"
      }
    ]
  },
  "msg_id": "localtesting.1518109316"
}
{
  "_text": "all-stars",
  "entities": {
    "organization": [
      {
        "confidence": 1,
        "value": "All-Star Game",
        "type": "value",
        "_entity": "organization",
        "_body": "all-stars",
        "_start": 0,
        "_end": 9
      }
    ]
  },
  "msg_id": "localtesting.1518109316"
}

Thank you again. I can delete so much code today :)

On Thu, Feb 8, 2018 at 11:52 AM Willy Blandin [email protected] wrote:

This is now fixed, thank you for your feedback and patience.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wit-ai/wit/issues/868#issuecomment-364175330, or mute the thread https://github.com/notifications/unsubscribe-auth/AAR3wgi7LfZPSn7YoeBPE6p-IK8dkvqYks5tSyZPgaJpZM4QsK8C .

yegeniy avatar Feb 08 '18 17:02 yegeniy

Cheers @yegeniy! -- biggest props go to @blandinw

stopachka avatar Feb 08 '18 21:02 stopachka