Recognize undefined Entities in Watson Conversation

北战南征 提交于 2019-12-12 03:34:31

问题


Please, I wanted to know if it is possible to catch different entities on Watson conversation without defining their values. For example, I am working on a Mobile up for room booking in my company and I can't define all the room's names so I want that my Bot recognize the name just according to the used pattern for example "Book @room for tomorrow" and whatever I put in place of @room it takes it as a room name.

thank you


回答1:


Its now available check out https://console.bluemix.net/docs/services/conversation/entities.html#pattern-entities

A pattern must be entered as a regular expression in the field. For instance internationalPhone: ^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$, e.g., +44 1962 815000




回答2:


EDIT: The solution below still works but right now the pattern entities as discussed by Dudi are more systematic solution. Leaving this here for legacy reasons.


Right now the regexp support inside Watson Conversation Service is probably the est bet.

For your particular example, you can use the following expression inside the dialog node condition:

input.text.matches('^[bB]ook[^\w]+(\w+).+ (tomorrow|today)$')

and inside that node you can add the following regexp to node context to extract the second word (or the word after "Book") to a variable:

"room" : "<? input.text.extract('^[bB]ook[^\\w]+(\\w+).+ (tomorrow|today)$',1) ?>" (note that in context unlike in conditions you need to actually escape \ with another \)

This will match inputs such as "book bathroom for today" or "book r101 for tomorrow".

A good place where you can try your regexp expressions is https://regex101.com/



来源:https://stackoverflow.com/questions/43187182/recognize-undefined-entities-in-watson-conversation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!