Synonyms mapping is not working for me

@faiza_conte,

I have two questions:

  • Do you have sentences with the common cold annotated as an entity? (docs)
  • Do you have the SynonymMapper in your config.yml:
pipeline:
  ...
  - name: EntitySynonymMapper

@Arjaan here is the config and the nlu list

Hi @faiza_conte,

The best thing to do is to add your sentence to the training data:

    - what is [common cold](sympthom)

Then the bot will learn to extract it from these type of sentences.

As your testers & users ask more and more questions, and you add sentences to your training data, your bot will become better & better at it, and it will also learn to generalize more beyond just the sentences you gave it during training.

okay @Arjaan thanks…now i was about to train it but am having issue with domain file…my syntax is correct but still gives me error domain.yml (11.9 KB)

@faiza_conte,

\t is a tab, which is not allowed.

It is very helpful to copy/paste your yaml file into that web-page that the error message refers too. It would catch these type of formatting details that are often hard to find otherwise.

I pasted in the web and it says valid yml

@Arjaan…i have phone extracted but the vaildation keep failing ,can you see it for me please

@faiza_conte,

That is great you’re extracting the phone_no. Almost there!

I think what is happening is the following:

  • You likely have multiple entitiy extractors in your NLU pipeline that can extract the phone_no, because it is not extracted as a single string, but as a list, with the same phone_no stored twice:
  • This is totally fine, but what happens is that your validation method is not able to handle a list, it expects the value to be a string: image

Possible Solution

I recommend you leave the “phone_no” extraction as is, because it is fine to extract it twice, but update your validation python code to handle both strings & lists for the value. Something like this:

    if isinstance(value, list):
        phone_no = value[0]  # just pick the first in the list
    else:
        phone_no = value

    if len(str(phone_no)) == 10:
        return {"phone_no": phone_no}
    else:
        dispatcher...etc...

@Arjaan…greate thank u so much…now I understand the issue …but the same issue is there while am trying to store it to the database…(insert into user_tb(name,email,phone_no) value (%s,%s,%s) ,(name,email,phone)) How I get the values is like this tracker.get_slot(name),tracker.get_slot(email),tracker.get_slot(phone_no) And while I was trying to store it to a database it thows error something like python list can not be converted to mysql…so just like the solution u gave me for the value then how can I fix the sql query to grab the first value so that it can store it to the database… thanks

1 Like

@Arjaan…can you please explain me here shortly on what kind of algorithms is used to build the rasa pipelines and policies …and when installing rasa we have a requirement.txt that needed to be installed so why do we need them or why rasa need them?

.