简体   繁体   中英

How to get parameters in a word for Chatbot(API.ai)

Hello im working on a chatbot which will give flight status. My bot is working fine if user inputs SU 1234, bot understands "SU" airline code and "1234" is the number. but if the user doesn't give space like "SU1234" bot cannot identify parameters of airline or flight number. Please help me to understand the bot ti search in a word.

With no code posted it's impossible to tell you what's wrong.

As a general advice I can say that if you have a regex and you want to match both "SU1234" and "SU 1234" then you may try something like /(\\w+)\\s*(\\d+)/ etc. - with optional whitespace. But I don't know if you're even using regexes at all since you're asking us to find problems in code that you haven't provided.

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