问题描述:

I'm trying to build a chatbot which requires large number of entity values to be added in the knowledge base (or at least I think it is).

Assume user just say a name of restaurant and we need to provide its details, like location, ratings, menu etc. So how can I make wit.ai to understand names without actually saving all available values.

网友答案:

Great question. It really depends on the number of values.

For values that don't change a lot (restaurants for example), you can use the HTTP API to add values programmatically to your app: https://wit.ai/docs/http/20160526#post--entities-link. They you will probably want to turn your entity as free-text&keyword. This is where it will be very important to validate expressions and tag the restaurant entity in these expressions. The more examples of queries you validated, the better Wit will be at guessing new values. A very simple example to help understand: if you validated "I want to book a table for 2 at BLABLA", "I need book a table at BLIBLI"... with BLABLA and BLIBLI as restaurant entities, Wit will be able to guess after enough examples that "Toto" is probably a restaurant entity value in the following expression "need to book a table at Toto" even if you never valided "Toto" as a restaurant value.

For values that change a lot over time (movies), you will probably want to use a free-text entity. Again this is where it will be very important to validate expressions and tag the restaurant entity in these expressions. The more examples of queries you validated, the better Wit will be at guessing new values. On your side, you will get a value that could be a movie but you will have to check that this is actually a real movie on your code.

More info on entities here: https://wit.ai/docs/recipes#which-entity-should-i-use

相关阅读:
Top