Shreeti
Shreeti

Reputation: 1

RASA entity is not detecting synonyms after training

I am trying to add synonyms for RASA entity. I have defined the synonyms in the training data itself. I have defined ner_synonyms in the configuration file also. After training if I give questions like “Upto how many sick leave can be accumulated” it is understanding the entity but when I am using sl instead of sick leave(“Upto how many sl can be accumulated”) it is not identifying the entity

training.json

{
 “rasa_nlu_data”: {
 “entity_synonyms”: [{
 “value”: “loss of pay”,
 “synonyms”: [
{
 “value”: “loss of pay”,
 “synonyms”: [
 “lop”, “leave withour pay”, “lwp”
 ]
 },
 {“value”: “casual leave”, “synonyms”: [“cl”]},
 {“value”: “privilege leave”, “synonyms”: [“pl”]},
 {“value”: “sick leave”, “synonyms”: [“sl”]}

…
 ],

“common_examples”: [ 
 { 
 “text”:”Upto how many sick leave can be accumulated”,
 “intent”:”leave_accumulate”,
 “entities”:[ 
 { 
 “start”:14,
 “end”:24,
 “value”:”sick leave”,
 “entity”:”leave_type”
 }
 ]
 },

…

}}

configuration.yml
language: “en”

pipeline:

- name: “nlp_spacy”
 model: “en”
- name: “tokenizer_spacy”
- name: “intent_featurizer_spacy”
- name: “intent_classifier_sklearn”
- name: “ner_crf”
- name: “ner_synonyms”

Upvotes: 0

Views: 1036

Answers (1)

Caleb Keller
Caleb Keller

Reputation: 2161

Adding synonyms does not train the model to recognize those synonym values. Please see the note in the Rasa NLU docs:

Please note that adding synonyms using the above format does not improve the model’s classification of those entities. Entities must be properly classified before they can be replaced with the synonym value.

To get better entity extraction add more common_examples with different synonym values. Especially if the synonyms have different word arrangements (2 words vs 1 word, etc)

Upvotes: 1

Related Questions