2

I have been having this problem in a variety of different cases.

I'll share an example of one.

I have a few FAQ intents. One answers "What is Named Entity Recognition" These are it's utterances :

  1. Tell me about Named Entity Recognition
  2. Tell me about NER
  3. What is NER
  4. What do you mean by Named Entity Recognition
  5. What is Named Entity Recognition

and the other answers "What is Optical Character Recognition?" These are it's utterances :

  1. OCR
  2. What do you mean by OCR
  3. Can you tell me what OCR is
  4. Tell about OCR
  5. What is optical character recognition
  6. What is OCR

When I enter, "What is ocr?" it works as expected and shows the answer for OCR. But when I instead enter OCR in all caps, with the same exact question (What is OCR?). It switches to the NER intent and shows me the answer for "What is NER?"

Can any one answer why it is doing so? and more important than that, What do I do to make it work as expected.

Do keep in mind that this is just one example. I have encountered this in many other similar scenarios too.

There was also a case where the intent utterances didn't seem to match even remotely. But it still switched to the wrong intent.

rici
  • 234,347
  • 28
  • 237
  • 341
  • Did you ever solve this? I am running into the same solution, and the only answer to this question doesn't solve the issue. My acronym is CAD, and I have cad, CAD, and c.a.d. in my slot and still doesn't work – Chris Adzima Sep 27 '19 at 17:21
  • Unfortunately, I had to use a few very inelegant workarounds. And even after that I kept running into some weird inconsistent results. So our company decided to move away from Lex itself. I'll answer my own question below – Gautam Jain Sep 29 '19 at 09:34

2 Answers2

4

As per the Lex and Alexa documentation, acronyms in custom slot types should be written as either a single word in all caps (OCR) or lowercase letters separated by periods and spaces (o. c. r.).

Along the bottom of the table, you can see the examples for Fire HD7, Fire h. d., Fire HD, and Fire HD 7 that demonstrate this -- both of the valid options will resolve to the same Slot Value Output.

Assuming utterances are set up in accordance with best practice, if you're providing vocal input, it's important to note that utterances are sensitive to things such as inflection in your voice, pacing/space between words, accents, and more.

As for immediate steps to improve accuracy, you can always try breaking up your intents further, where instead of having two intents, you have one for each permutation of custom slot value (NER, Named Entity Recognition, OCR, and Optical Character Recognition). It's easy for humans to understand that the first letter of a phrase maps to the letters in an acronym, but when it comes to teaching a chatbot to understand that these phrases are synonymous, that's a bit harder.

Nick Walsh
  • 1,807
  • 5
  • 16
0

In the end I didn't find a proper solution but used some really inelegant workarounds, but hey as long as it works :D

The workaround I used was to make a "what" intent, a "how" intent etc. Keeping the sentence structure intact:

For example :

IntentName => "Bot_HowTo"

Utterances => 
"What is {slotName}"
"What are {slotName}"
"Meaning of {slotName}"

Slots =>
name : "slotName"
values (using synonyms) : 
{OCR => "ocr", Optical Character recognition"}
{NER=> "ner", Named Entity Recognition"}

This makes the amount of intents needed much less and also eliminates a lot of the ambiguity. All questions that have "what" or similar formats go straight to that intent.

And then in my codehook I see which synonym was matched and provide the answer accordingly.