简体   繁体   中英

IBM Watson Assistant: How to create dialog that will only accept 1 kind of entity

I'm trying to create a dialog that accepts only 1 entity

Entities
@cat : cat
@dog : dog
@alligator : alligator, crocodile

I am trying to solve it with this condition:

If Watson recognizes:
@cat and !@dog and !@alligator

respond
cat entity will display

is there any other way to achieve this without specifying the other entities?

You can use various kinds of conditions in the evaluation of a dialog node. In my collection of tips and tricks for IBM Watson Assistant I am using entities.size() to access how many entities have been detected.

You could use something like @cat AND entities.size()==1 to check that cat was detected and it is the only entity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM