How to pass synonym’s value to slot in story.md file Please explain with example.
In your nlu.md
## intent:askWeather
- what's the weather like in [NY]{"entity": "city", "value": "New York"}
Bot will set the city
slot to New York
if you have this example and city
as an entity and as a slot in your domain.yml.
You can read more about these here:
For an example: nlu.md file contains
synonym:New York City
- NYC
- nyc
- the big apple
stories.md file contains
* i_ask_weather{“entity”: “city”, “value”: “New York”}
- slot{“city”:“New York”}
But tracker.get_slot(“city”), results into None value
I mean is there any way to get entity values(like NYC,nyc or the big apple) in action file. Note: I do not want to create multiple stories for each entity
Do you have EntitySynonymMapper
and CRFEntityExtractor
or DIET in your config.yml
?
Make sure your nlu.md contains at least one or more examples, not just synonyms for city
.
If these things are ok, there is something wrong. tracker.get_slot(“city”)
should work.
Yes.
what should be the expected output of the this statement tracker.get_slot(“city”) I want any one of these - NYC, nyc, the big apple
Also in domin.yml file what should be the type of slot, i have taken it as a ‘unfeaturized’, is it fine?
Those are synonyms. If user says “I live in NYC” or " What city is called The Big Apple". In both scenarios city
is set to New York
.
If you now try to get the city using tracker.get_clot()
city = tracker.get_slot(“city”)
city
variable would be New York
.
Something like this would work:
entities:
- city
slots:
city:
type: unfeaturized
I’m still figuring out why it’s not working for you.
Can you give one example from your nlu.md
where you have city
entity?
Ok let it be I wanted the values ‘NYC’ and ‘The Big Apple’ in my action file. I wanted to implement some custom business logic on based of these values…New York as a values is no use to me…
I guess creating multiple stories for every entity values and storing the values under slot is the option I left with…
Anyways thank you very much for support…Appreciated.
If you want to do that, you can just remove all synonyms.
- what's the weather like in [NYC]{"entity": "city"}
- It's [The Big Apple]{"entity": "city"}
slot is set to NYC
in the first one and The Big Apple
in the second.