Rasa mapping entities

Hello Team, I’m quite excited to start with AI and Rasa, however I’m just an Android developer and I don’t know about pyhthon, I’m building a Voice Assistant for my app, and basically I want to use Rasa only for “commands” recognition since almost everything I need to do it in my app so I don’t need much I think, (if there is a better solution and Rasa is a overkill please let me know)

I have some issues with entities, the main issuses are that I want to work this “universal”, I’m not sure how is the best way to extract entities for locations/places

I Have the following intents: - intent: navigation_location examples: | - navigate to home - take me to my place - start navigation to my work - go to mcdonalds please - could you please go to Walmart - take me to the airport - please navigate to starbucks - let’s go to Irish bar - directions to The mall - please take me to the nearestgas station
- start navigation to central park

but if I say something like “take me to Alexander Platz” it does not recognize and actually I’m using SpacyNLP for contact names and recognize “Alexander”(Person) and Platz (Person) which I don’t want it.

this is my rules: - rule: Activate navigation location form steps: - intent: navigation_location - action: navigation_location_form - active_loop: navigation_location_form

 - rule: Navigation place Received form
   condition:
   - active_loop: navigation_location_form
   steps:
   - action: navigation_location_form
   - active_loop: null
   - slot_was_set:
       - requested_slot: null
   - action: utter_navigate_to_place
   - action: action_reset_all_slots   


forms:
  contact_name_form:
    required_slots:
      contact:
      - type: from_entity
        entity: PERSON
  navigation_location_form:
    required_slots:
      place_to_navigate:
      - type: from_entity
        entity: location
  navigation_address_form:
    required_slots:
      place_to_navigate:
      - type: from_entity
        entity: place_to_go
  weather_form:
    required_slots:
      weather_location:
      - type: from_entity
        entity: location   

another problem is that if I say “weather in San Francisco” it does not recognize “san francisco” or it does but as a PERSON, should I remove better SpacyNLP??

this is my pipeline

language: en

pipeline:
# # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
# # If you'd like to customize it, uncomment and adjust the pipeline.
# # See https://rasa.com/docs/rasa/tuning-your-model for more information.
  - name: SpacyNLP
    model: "en_core_web_md"
  - name: SpacyTokenizer
  - name: SpacyFeaturizer
  - name: SpacyEntityExtractor
    dimensions: ["PERSON"]    
  - name: RegexFeaturizer
  - name: LexicalSyntacticFeaturizer
  - name: CountVectorsFeaturizer
  - name: CRFEntityExtractor
  - name: CountVectorsFeaturizer
    analyzer: "char_wb"
    min_ngram: 1
    max_ngram: 4
  - name: DIETClassifier
    entity_recognition: False
    batch_strategy: sequence
    epochs: 100 
  - name: EntitySynonymMapper
  - name: ResponseSelector
    epochs: 100

To be honest I’m not sure about the pipeline, because I’m still learning…

The idea oveall is use as voice assitant “take me to Some place” and I’m using rasa to help me like “navigate” and ask “Where do you want to go?” with the forms so I don’t have to handle this AI logic in the app, and then I will set a string to return the entity and process this inside the Android App. I’m having other intents but “contacts” and “places”/location are the importants for me

 intent: call_contact
  examples: |
    - call [Sara](PERSON)
    - call [jose](PERSON)
    - dial [Javier](PERSON)
    - make a call to [Pedro Mendoza](PERSON)
    - could you call [Monika](PERSON)?
    - contact [Mom](PERSON)
    - put [Dad](name) on the phone
    - can you call [Ricardo](PERSON)?
    - call
    - please call [Javier Mejia](PERSON)
    - [Monica](PERSON)

What is the best way to extrac “places” to go? like mcdonalds, cities, park, locations… can someone please point me in the right direction? Thanks a lot!!! I’m still learning but sometimes Idk where to go

Hey @zenyagami, it’s generally difficult to recognise entities which are different from those seen in the training data. There’s no easy solution for this, but a few things I recommend trying are:

  • Merge the location and place_to_go entities into one that’d be used in both forms. I assume the values of these entities are often very similar, which confuses the model a lot and makes the entity extraction performance much worse.
  • Use DIET for both intent classification and entity extraction (i.e. remove entity_recognition: False and remove CRFEntityExtractor from the pipeline.
  • Try out extracting locations with Spacy, it may or may not work well but is worth a try (I think the LOC and GPE dimensions need to be added)
  • If all else fails, a bulletproof method should be to have a form where the location or contact is extracted using the from_text slot mapping, i.e. the entire user message is taken as the value of the location/contact slot.
  • Similar to above, you can also try to implement some extraction heuristics in a custom slot mapping, e.g. if a message is in the format weather in XYZ, you extract XYZ as a location.

Let me know how it goes.