I am building a voice commerce action for a big food chain and we expect to receive a massive load of orders via voice. The problem is that we haven't be able to figure out a safe way to capture the user's phone. We are currently trying with sys.phone-number and sys.any but it get the number wrong 90% of the time.
This solution is being deployed to Brazil with local number format xx-xxxxxxxx (2 numbers followed by 9 numbers - 0 to 9)
You may take the help of Regex. You can set a pattern and in the webhook check if the number matches your requirement else ask for input again.For example for a Bangladeshi contact number i have used my own custom entity using regex:
(01[3456789])(\d{8})
you can follow this example
Related
I'm creating a chatbot in Dialogflow in which the user is expected to enter a frequency of time, followed by specifying the time. i.e :
Bot: how many entries will you make on that day? (Or what so the frequency of your entries)?
User: Twice daily or two times a day.
Bot: Please enter those times.
User: 9 am and 7 pm
Now the problem is even if I enter more than two times it will still get accepted as the time by Dialogflow.
I need to implement a check here that will take only times if the user enters twice daily and accept three times if the frequency is thrice daily.
Is it possible to do this by manipulating entities and intents? I want to avoid doing this in the webhook.
Also the webhook I'll be implementing is in python. So can't use Node.js inline editor.
No, this can't be done in the Intents only. Remember that an Intent represents what the user has said, and not how you are using.
As you surmise, the best place to check these values are in your webhook fulfillment. Since you already have a webhook, it isn't clear why you are avoiding this.
In terms of design, you may wish to skip asking for the frequency and just ask the user to tell you when they'll be making the entries. You can then confirm that was all that they wanted, accept more if they needed more, etc.
I have some question about some "best practice" for certain issues that we are facing using LUIS, QnA Maker, in particular for the Dispatcher:
1) Is there any best practice in case we have more that 15k utterances in the Dispatcher? That's looks like a limitation of the LUIS apps but the scalability of the model in the long run will be questionable.
2) Bing Spell Check for LUIS changes names and surnames for example, how to avoid this? I guess that Bing Spell Check is necessary when we are talking about ChatBots, since the typo are always behind the door, but using it for names is dangerous.
3) Cross validation is not supported out of the box, you would have split your data to folds with custom code (not difficult), use the command line to train and publish your model on your k-1/k folds, then send the k-fold utterances to the API one-by-one. Batch upload is only supported through the UI https://cognitive.uservoice.com/forums/551524-language-understanding-luis/suggestions/20082157-add-api-to-batch-test-model and is limited to a test set of 1,000 utterances. If we use the one-by-one approach, we pay $1,50 per 1k transactions https://azure.microsoft.com/de-de/pricing/details/cognitive-services/language-understanding-intelligent-services/ and this means to get cross-validation metrics for the 5 folds for example, we could be paying about 20$ for a single experiment with our current data, more if we add more data.
4) Model is a black box, which doesn't give us the ability to use custom features if needed.
I will try to address your concerns in the best possible way I can as follows:
1) As per the LUIS documentation,
Hence, you cannot exceed the limit. In case of Dispatch apps,if the total utterance exceeds 15k, then dispatch will down sample the utterances to keep it under 15k. There is an optional parameter(--doAutoActiveLearning) for CLI to do auto active learning which will down sample intelligently (remove non relevant utterances).
--doAutoActiveLearning: (optional) Default to false. LUIS limit on training-set size is 15000. When a LUIS app has much more utterances for training, Dispatch's auto active learning process can intelligently down sample the utterances.
2) Bing Spell Check helps users to correct misspelled words in utterances before LUIS predicts the score and entities of the utterance. However, if you want to avoid using Bing Spell Check API service, then you will need to add the correct and incorrect spelling which can be done in two ways:
Label example utterances that have the all the different spellings so that LUIS can learn proper spelling as well as typos. This option requires more labeling effort than using a spell checker.
Create a phrase list with all variations of the word. With this solution, you do not need to label the word variations in the example utterances.
3) As per the current documentation, a maximum of 1000 utterances are allowed per test. The data set is a JSON-formatted file containing a maximum of 1,000 labeled non-duplicate utterances. You can test up to 10 data sets in an app. If you need to test more, delete a data set and then add a new one. I would suggest you to report it as a feature request in the feedback forum.
Hope this helps.
What is the best way to collect a phone number? I struggled with this a few months ago, so maybe some things have been updated since then. I ended up creating a collect phone number action that would convert 10 concepts (one for each phone digit) to a string and then send that in an api call. I did not see a library capsule that took care of this but whether library capsule or not, is there a better way to collect a phone number? hopefully this question saves a lot of people the trouble of defining 10 concepts!
You would not need a separate concept per digit; a text primitive concept that holds a full number is all you would need.
Additionally, using an input-view to show the user a form requesting their phone number would be the best method of implementing your use case.
This input-view form can be additionally modified with a mask attribute to ensure that invalid entries are checked as the user enters them. You can learn more about how to further customize your mask attribute here in our documentation.
For example, the following code snippet would only allow a phone number with the pattern (100) 000-0000.
text-input {
id (pnumber)
type (PhoneNumber)
label (Phone Number)
pattern {
mask ("(100) 000-0000")
}
value ("#{raw(this.phoneNumber)}")
}
I am trying to extract numeric information from set of SMSs. The regexes fail in extracting balance and credit amounts as the patterns of the SMS is not consistent throughout the industry.
We are currently making assumptions to make it work like First Amount = Credit amount
Second Amount=Balance.
This has lot of limitations and error rate is gradually increasing.
Anyone has any alternatives to regexes?
There is no standard for this kind of message as every operator creates its own messages. this is marketing communication... Yet, for a given operator and a given plan all replies to balance inquiry messages should be the sames (as long as they are not changed by operators marketing teams...).
Regexes are a good tool but you need to know the message forehand and create the appropriate regex patterns
My bot reads and replies in simple mail conversation. More like in chat manner, one or 2 sentences only done through email. My backend is taking care of reading emails, interpreting api.ai responses, storing locally useful data and sending next questions. Before sending to api.ai, messages are split in sentences.
What I've seen from example conversations already done by humans is that the end users are quite often sending several significant information in one sentence. That means that from e.g. 8 possible peaces of information I totally can have (mostly non required) I can get in one sentence any 2 of them.
How to organize that?
I started with one intent for each field I require. But to solve case with any two intents in one sentence, I am extending user says examples with other field too. At the end I will have 8 intents which are actually filled with similar examples.
Now I am thinking to have just one intent and cover all in it. That might work, but the real question is that really way to do it?
Here are example conversations to describe issue better
v1 - simple way like in api.ai examples
- u: Hi. I need notebook bellow $700.
- b: Great. What size should it be?
- u: 17'
- b: I have gaming one at $590 and one professional for $650.
- u: I more to gaming one.
v2 - what I can expect from real life examples
- u: Hi I would like to buy 15 inch gaming laptop.
- great, what price range?
- ...
Api.ai has a feature called slot filling that allows to collect parameter values within a single intent. It's great for building conversational interfaces. You can see if it's compatible with you use case.
Here's how such intent could look like for the examples you provided:
See the "book_notebook" intent:
and how it would work in conversation:
See a test for the "book_notebook" intent: