wit icon indicating copy to clipboard operation
wit copied to clipboard

Cant get engine to understand - simple order-food example

Open gorenbox opened this issue 8 years ago • 13 comments

Hi,

I created a simple model with menu items (pizza, beer, cake...), and a composite entity menuItemOrder (which is a quantity + menu Item, ex, "3 pizzas"). An Oder can either be "I want 3 pizzas" where u get a menuItemOrder, or "I want a pizza" where you just get a menuItem.

Unfortunately, wit doesn't wit model seem to be able to parse something like "I want a pizza" , no matter how many examples, it seems to think pizza is menuItemOrder which should also have a quantity.

This is the app info: ID: 5aa646f9-cb79-47e1-b709-8c6a4853817b

gorenbox avatar May 08 '18 09:05 gorenbox

Here is another example, image

gorenbox avatar May 10 '18 09:05 gorenbox

I don't think you should make a separate entity with numbers, I mean the amount of combinations is infinite: 1 milkshake, 2 milkshakes, 3 milkshakes, 4 milkshakes, 55 milkshakes and etc. Teaching every possible number with every possible food is too much, instead just use the wit/number to determine the number of items. If you have a sentence like "2 hamburgers and 3 milkshakes", add roles to the items and numbers to identify how they are connected, or use the verbose to identify where the number is located in the sentence and what it can mean by that. The verbose method is actually better, since you won't have to train a lot of different scenarios, however you would need to write some extra code to determine the relationship of entities in the sentence based on their location in the sentence, a bit more work but your bot will be a bit smarter.

vladikus10 avatar May 10 '18 11:05 vladikus10

Hi, thx for feedback. I wouldnt think you would need to train for each possibility of number. It is a composite entity, similar to the example https://medium.com/wit-ai/reintroducing-composite-entities-c361797ca202 where you have car model, defined as year + carType (ex, 1940 BMW)...and you dont have to train it with each possible year.

gorenbox avatar May 10 '18 11:05 gorenbox

about your example, where you have a list of items, 2 milkshakes and 2 hamburgers, I dont think roles is suitable: search for "Differentiate several entities according to their role in the message" in the recipes documentation, they give this exact example (3rd example). I think for a list of items you would just train with several examples of lists and hopefully, the engine will recognize you can get a single item or a list. In some other platforms you can state whether an entity can be a list of items

gorenbox avatar May 10 '18 11:05 gorenbox

Oh sorry, I never knew they existed, that kinda makes things easier, if it will work :D. I tried a few validations and it does seem to struggle a bit. I guess maybe, because it's bit more complex type of entities, you might need to correct it more than usual for the app to properly understand. I wonder if you can train samples with composite entities through their API? That way you could create a script with a large amount of samples with different numbers and combos, perhaps then your app would be able to understand better.

vladikus10 avatar May 10 '18 11:05 vladikus10

@l5t what do you think of this?

gorenbox avatar May 12 '18 20:05 gorenbox

If I understand correctly, you're trying to say that menuItem should always be part of a menuItemOrder, which is not something you can do in Wit.

It is true that wit/number will not capture "a" as a quantity. You could default to 1 when you don't have a quantity associated with it, giving some kind of visual feedback to the end user (like showing the status of their order).

blandinw avatar May 13 '18 21:05 blandinw

@blandinw thanks for you reply. It is exactly the contrary! we dont say that menuItem should always be part of a menuItemOrder, BUT that an order can have menuItem "I want a milkshake" or menuItemOrder, "I want 3 milkshakes". both are acceptable. We also DOn'T expect to map a to a number, that is why we are training the model with 2 options order with menuItem, where there is no quantity, and order with menuItemOrder where there is quantity

gorenbox avatar May 14 '18 05:05 gorenbox

@gorenbox Haha, I misunderstood then! Can you clearly state what the problem is?

Here is what "I want a pizza" gives me, which seems correct: image

blandinw avatar May 14 '18 13:05 blandinw

(closing from lack of response -- feel free to reopen @gorenbox)

stopachka avatar May 21 '18 03:05 stopachka

Hi @stopachka sorry for late response, was out... the issue is as documented, please look at the screenshots I attached. sometimes I write "I want 3 hamburgers" and it is supposed to recognize 3 hamburgers as the composite entity menuItemOrder which is quantity + item, and sometimes I write "I want a hambuger" and it is supposed to extract hamburger as a menuItem which is just item without quantity. The problem is it gets confused. actually now it is working which is strange as I have not changed the model or added training...i have seen other people also state that there are inconsistent results, that suddenly things start working. Are you aware of this?

gorenbox avatar May 22 '18 14:05 gorenbox

hi,

i wrote a comment. appreciate your feedback

best dan

On Mon, May 21, 2018 at 6:52 AM, Stepan Parunashvili < [email protected]> wrote:

(closing from lack of response -- feel free to reopen @gorenbox https://github.com/gorenbox)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wit-ai/wit/issues/1074#issuecomment-390546241, or mute the thread https://github.com/notifications/unsubscribe-auth/AYVBDab-75SQ8f92xjJUP60Tr8FapmpOks5t0joDgaJpZM4T2UZV .

gorenbox avatar May 22 '18 14:05 gorenbox

@gorenbox Glad it's working now. No, models shouldn't be affected unless you did some changes like validating entities. Please ping back if you still experience issues. Thanks!

patapizza avatar May 25 '18 19:05 patapizza