How to pass synonym value to slot in file

How to pass synonym’s value to slot in file Please explain with example.

In your

## 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: file contains

synonym:New York City

  • NYC
  • nyc
  • the big apple 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 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.


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:

  - city

    type: unfeaturized

I’m still figuring out why it’s not working for you. Can you give one example from your where you have city entity?

1 Like

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.:relieved:

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.

1 Like