DialogFlow: import training phrases from a document rather than input manually? - dialogflow-es

DialogFlow: how to import training phrases from a document rather than input manually?

If there's a lot, you could use API to add them programmably. What you need is to add your training phrases to Intent through https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.intents
Another one-off and hacky is to export the agent in agent settings, edit the exported files (look for the user says files), add your training phrases there, and restore.

Related

Having issues with email and person entities in the same intent

We have an intent which catches a person's name and email. Below is how our training data looks.
The problem is with utterances which contain just name and email, without additional phrases around. As we are using it in SMS conversation, I guess that it could be quite often the case.
For example if user types in "Mark Randel gone#hotmail.com", we will get name: Mark and email: Randelgone#hotmail.com
I noticed that if we enter an exact phrase as it is in one of the utterances in training phrases, we will get the right result, but obviously, we can not add all possible combinations here.
Would it be expected that recognition will improve if we add additional 20-30 training phrases with various just name and email combinations? This would be kind of strange, because, what is the point of system entities in that case?
Has anyone had a similar issue?
In Dialogflow ES, default #sys.email entity allows empty string for extracting email. I think this cause the problem.
You use regexp entities with email regex, so that you might be able to extract only valid email string.
EDIT
In my environment, I created regex custom entity for extracting email.
Entity
regex : [\w-\.]+#([\w-]+\.)+[\w-]{2,4}
Test
input : Mark Randel gone#hotmail.com
output :
parameters
value
person
{'name': 'Mark Randel'}
regex-email
gone#hotmail.com

Exact match on training phrase intent Dialogflow

The Training phrase only contains How to order but when I only type "order" it still shows or reply to me.
What can I do to make it reply to only very specific words?
image
If I didn't explain my problem well enough, here's a link on a guy that has the same problem and has better english compared to mine
https://www.reddit.com/r/Dialogflow/comments/dmy5x6/exact_match/
Click the option button (three dotted button) beside the save button inside the intent.
Click on 'disable ML'.
If Ml is disabled, The Intent will follow Rule-based grammar matching algorithm which means it will only match user expressions with the exact training phrases defined in the intent.
Add the keyword 'order' in the default fallback intent's training phrase and you should be fine. OR
You can also create a new Intent that handles only a specific keyword like 'order' in your case and add a quick reply saying did you mean how to order? Yes & No
Hope this helps :) If you have some queries do drop a comment.

DialogFlow- Invoke intent without training phrases and saving response

I'm trying to build a basic "question/answer" app in Actions using DialogFlow. Right now I have two intents:
Intent 1: User says "Ask me a question" and the intent responds "Tell me about yourself"
Intent 2: I'd like to capture the user response to "tell me about yourself", but frankly there's no way to write enough training phrases to cover it.
I tried following this suggestion, and having Intent 1 send an output context called save_response and Intent 2 has an input context of save_response. Then for the training phrase I used #sys.any:save_response
When I try this action, it just invokes the default fallback intent every time. Thoughts on where I might be going wrong?
You need to create 2 intents, in the first intent your training phrase would be Ask me a question, output context will be save_response and response will be the question which you want to throw at the user.
Then in intent 2, you need to do following:
Set input context to save_response, so that it will only be
triggered when this is present in the contexts
Go to actions and parameters section and create a parameter named
answer, give entity type as #sys.any
Then go to training phrases section and add any training phrase, then
highlight it all, and select the parameter you just created
After that, your training phrases and entity section will be looking
like something like below image
Save the intent and you are done
Hope it helps.
In general, having an Intent with a training phrase that consists only of #sys.any may not always work as you expect.
Better would be to have a Fallback Intent that has the Input Context set to make sure you only capture things in that state (save_response in your case) and then to use the full text captured in your fulfillment.
When doing it this way, you do not need the "Intent 2" you described - or rather, this would be a Fallback Intent that you create in the Dialogflow UI. The Fallback Intent is triggered if no other Intent would match what the user has said.
To create a Fallback Intent, select the three dots in the upper right of the Dialogflow UI
then select "Create Fallback Intent"
The Fallback Intent editor is very similar to the normal Intent editor. The biggest difference is that the phrases you enter (and you don't need to enter any) will explicitly not match this Intent, and there are no parameters. Other aspects (the name, the Incoming Context, turning on fulfillment) are the same.

Google prediction API - Training data syntax for multi classification

Trying to harness the power of Google Prediction API, to classify my data. Each item in my DB can have multi categories assign to it.
For example: "My Nexus phone is rebooting constantly" could be assigned both #Android and #troubleshooting tags.
I would like to upload my training data to Google, but I'm not sure how to apply both tags to the same content. In the following example I've found the syntax that provide one category for each content like so:
"Android" ,"My Nexus phone is rebooting constantly"
What is the right syntax for multi-classification training data?
Unless I'm misunderstanding something from your question, I think the answer to it is in the docs here.
Namely, the section about text strings explains that when you submit a text string, the system actually cuts it into multiple strings, separating everything using whitespaces as a delimiter. They point out to "Godzilla vs Mothra" to be "Godzilla", "vs", and "Mothra". So in your case, you could just use "Android troubleshooting". The system will separate it in "Android" and "troubleshooting".
From the docs:
Each line can only have one label assigned, but you can apply multiple labels to one example by repeating an example and applying different labels to each one. For example:
"excited", "OMG! Just had a fabulous day!"
"annoying", "OMG! Just had a fabulous day!"
If you send a tweet to this model, you might get a classification something like this: "excited":0.6, "annoying":0.2.

SentenceSplitter in GATE

I am trying to detect Sentences using GATE and more specifically using either ANNIE SentenceSplitter or RegexSentenceSplitter.
RegexSentenceSplitter seems to be working very well, however the only problem is that a new sentence annotation is being created at the beginning of each new page of the document. (The documents analysed are PDFs).
Is it possible to change this behavior of the RegexSentenceSplitter?
You can probably try to use a conditional corpus pipeline. This method allows you to run PR (here the RegExSentenceSplitter) or not according to the value of a feature on the document.
More details here: https://gate.ac.uk/sale/tao/splitch3.html#x6-480003.8.2

Resources