Entity value not correct using Synonyms

Hello,

I have an entity called “single_return”. In my NLU file I have:

## intent:single
- I want to buy a [single](single_return) ticket
- [alone](single_return:single)
- [solo](single_return:single) please
- [1234](single_return:single) ticket please
- Only one ticket please
- Just a [unaccompanied](single_return:single) ticket
- just [single](single_return)
- just one [single](single_return) ticket
- just one ticket
- a [one way](single_return) flight please
- I want a [one way](single_return) ticket
- [one way](single_return) please
- [one way](single_return)
- I just want [one way](single_return) thanks
- [one way](single_return) ticket please
- just one ticket please
- alone

My config file is:

language: en
pipeline:
    - name: "SpacyNLP"
      model: "en_core_web_lg"
      case_sensitive: false
    - name: "SpacyTokenizer"
    - name: "SpacyFeaturizer"
    - name: "RegexFeaturizer"
    - name: "EntitySynonymMapper"
    - name: "DIETClassifier"
    - name: "ResponseSelector"
      retrieval_intent: faqs   
    - name: "SpacyEntityExtractor"
      dimensions: ['ORG']
    - name: "DucklingHTTPExtractor"
      url: "http://localhost:8000"
      dimensions: ['time', 'number']
      timezone: "Europe/Lisbon"


policies:
    - name: MemoizationPolicy
    - name: TEDPolicy
    - name: MappingPolicy
    - name: FormPolicy
    - name: "FallbackPolicy"
      nlu_threshold: 0.3
      ambiguity_threshold: 0.1
      core_threshold: 0.3
      fallback_action_name: "utter_fallback"

Whenever I say “solo”, the entity value of single_return is “solo”, instead of “single”. Why is this happening?

Hey @teresalazar13. The problem is in your NLU pipeline configuration - the component EntitySynonymMapper should come after the DIETClassifier and entity extractors for the synonyms to be mapped after entities are extracted by the classifier. So if you put the EntitySynonymMapper at the end of your pipeline, it should work then :slight_smile:

1 Like

Thank you so much. It is working now :slight_smile:

I have another question. Do Synonyms work with duckling or spacy entities? @Juste