Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
612 views
in Technique[技术] by (71.8m points)

botframework - Dispatch CLI not passing Entities from Luis App

When generating a Dispatch model using the CLI, it doesn't pass the Entities from the Luis app in reference. This drastically affects the accuracy of the dispatch app.

For example, for the utterance "My [iPhone] isn't working", iPhone is attached to an entity list name CellPhoneType. There are three items in the list iPhone, Samsung, Smartphone.

In the bot emulator, using the Dispatch, if I write "my iPhone isn't working", the dispatch model passes it to Luis, as it should. However, if I write "my smartphone isn't working", the dispatch tool sends it over to QnA Maker.

I checked the model, and the entities are not passed in reference. I also tested with simple entities, they do not work as well.

I have the most recent version of the CLI installed.

Is this normal, is this a bug? Is there a work around to fix this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

So a couple things to address here with how you've built your LUIS model and what to expect from dispatch. Skip down to 2.) if you're a user who's reading this post and already has entities working in child LUIS models beautifully. @AlexandreViegas, read point 1.) to help properly build your LUIS model to detect intent properly in dispatch.


1. Use a Simple Entity + Phrase List to take Advantage of LUIS's machine learning--not List Entity

Right now it seems like your choice of using a list entity is not the best way to go here, and not how it's intended to be used. Instead list entities are used for terms that might have multiple ways of referring to the same thing.

Examples of When You Would Want to Use a List Entity

For example, California, Cali, CA, and The Golden State are all terms that refer to the same thing (a state). You can create a "States" list entity, include all 50 U.S. states and their nicknames. Now since this is a closed, explicit list, there is no machine learning when you use a list entity--LUIS will only detect "States" list entity if there's an exact text match.

Another example of when you would want to use list entities would be say with "Departments" for a school. You could have "chemistry", "CHEM142", "chem", etc. all meant to refer to that specific department, and do so with the rest of the departments in the school.

Why you want to use a Simple Entity and add a Phrase List

You can refer to this other StackOverflow answer I wrote, regarding how to create a simple entity and boost the signal of the entity using a phrase list.

To not completely duplicate the answer given in the link above, in essence, you want to use a simple entity, so LUIS can properly predict terms as CellPhoneType entity, even though you did not explicitly include it in your model.

For example you could have a Phone intent with utterances labeling various words as CellPhoneIntententity. enter image description here

When I go to the Test panel, I type in "sunflower" and "moonstone" as made up mobile phones (maybe some phone company in the future creates phones with these names as their models):

enter image description here

Above you can see LUIS correctly predicts Phone intent and correctly extracts sunflower and moonstone as CellPhoneType entities.

However if I enter in brand names of mobiles that don't exist in the English language--for example Blackberry's "Z3" or T-Mobile's "G2X", LUIS cannot detect this with our model as is right now. (See 2 most recent utterances). enter image description here

Above you can see utterances "i'd like to order a z3" and "my g2x is broken" do not properly predict as Phone intent, nor do z3 or g2x get detected as CellPhoneType entity. This is where phrase lists come in. As specified in the docs, phrase lists are good for boosting the signal of what a cell phone type may look like, as well as adding proprietary or foreign words to your LUIS model, such as the "made-up" words of many cell phone models. Again, refer to the StackOverflow answer I linked to, if you need guidance on how to create a phrase list.

After adding different names of cell phone models to phrase list enter image description here enter image description here


2. Query the endpoint of the LUIS model that was created by dispatch directly

Clarification:

  • When you add a child LUIS model to dispatch, even if that child LUIS model has entities in it, it will not show up in the model of the parent LUIS model created by dispatch.
  • the exception to the above bullet would be if you labelled an entity in a pattern

  • Why entities do not need to be labelled in the parent LUIS model, is because when you call the endpoint of the parent LUIS model, it does sort of a shared call, under the hood, so it doesn't have to ping LUIS twice.

  • You see the entities labelled from the child LUIS model in the connectedServiceResult property

How to extract entities from child LUIS model, using your parent dispatch LUIS app

  1. Make sure to publish both the child LUIS app and the parent dispatch app.

  2. Going to your parent dispatch-created LUIS app, go to Manage > Keys and Endpoints > click "Endpoint" to open a browser tab where your can query the parent app in the URL after q=

  3. type in your utterances in the URL, after q= to see the entities and intents extracted from the child LUIS model under connectedServiceResult

https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx?verbose=true&timezoneOffset=-360&subscription-key=b7xxxxxxxxxxxxxxxxxxxxxxxxxxxx67&q=my%20iphone%20is%20broken

{
  "query": "my iphone is broken",
  "topScoringIntent": {
    "intent": "l_Reminders",
    "score": 0.99594605
  },
  "intents": [
    {
      "intent": "l_Reminders",
      "score": 0.99594605
    },
    {
      "intent": "None",
      "score": 0.002990469
    }
  ],
  "entities": [],
  "connectedServiceResult": {
    "query": "my iphone is broken",
    "topScoringIntent": {
      "intent": "Phone",
      "score": 0.9658808
    },
    "intents": [
      {
        "intent": "Phone",
        "score": 0.9658808
      },
      {
        "intent": "Calendar.Add",
        "score": 0.0142210266
      },
      {
        "intent": "Calendar.Find",
        "score": 0.0112086516
      },
      {
        "intent": "None",
        "score": 0.009813501
      },
      {
        "intent": "Email",
        "score": 0.0025855056
      }
    ],
    "entities": [
      {
        "entity": "iphone",
        "type": "CellPhoneType",
        "startIndex": 3,
        "endIndex": 8,
        "score": 0.998970151
      }
    ]
  }
}

Above you can see that the parent LUIS app created from dispatch properly identifies iphone from the utterance my iphone is broken as a CellphoneType entity.

Note: you will not see results from the child LUIS model in the Test panel of the parent dispatch, because the UI does not show connectedServiceResult


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...