简体   繁体   中英

How do I make my agent repeat any name - Dialogflow

I want to make an agent that can just repeat whatever name I say:

I have 1 Entity called: Name.

I have 1 Intent called: RepeatName.

I have 1 Training phrase:

"Repeat this name: {Name}"

Then I highlighted '{Name}' and clicked my entity @Name

Then below that Training phrase is the following:

Parameter Name: Name
Entity: @Name
Resolved Value: {Name}

Under Actions and parameters I have:

Required: Checked
Parameter Name: Name
Entity: @Name
Value: $Name

Under Responses I have the Text Response:

"Ok. I'll repeat this name: $Name"

Then I try it out with:

"Repeat this name: John"

But then it doesn't set the parameter Name

However when I try:

"Repeat this name: Name"

Then I get the expected response:

"Ok. I'll repeat this name: Name"

I don't understand how adding more training phrases would help, because a name could be anything. I'm new to Dialogflow so I might be missing some basic concepts here.

Any help would be appreciated.

Try it with inbuilt system entity - @sys.given-name .

What you have done is created an entity called Name , then you have enabled define synonyms which is used to create examples of your entity.
But then you have disabled allowed automated expansion which means anything other than your defined synonyms will not be identified as your entity.
You have defined only one synonym ie Name so only that is being recognized.

So either try the same with @sys.given-name which is pre-trained for identifying names, or train your custom entity Name with as many examples as you can after enabling allowed automatic expansion (but that might lead to recognize wrong values).

重复名称意图

Hope it helps.

The issue is that you're using a Developer Entity Type to try and define the parameter that you expect to capture here. You then don't specify any possible entity values for that Entity Type except "name". So the name "name" is the only one that matches.

You have a few options.

You can use the System Entity Type of @sys.given-name . This includes the most common names of a particular language, but may not be good enough if you're expecting other names.

You could use the System Entity Type of @sys.any , but overuse of this entity type isn't suggested, since it may pick up garbage or not match the phrase well.

Similarly, you can set your entity type to allow automated expansion , but you still run the risk of not capturing things correctly if you don't have the training phrase exact and picking up garbage.

Figuring out which option works best for you will require some testing on your part. Generally I will use entities when I can clearly define the types or aliases, and use @sys.any when I can't.

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