[Solved] RASA FormPolicy

rasa-core
(Yanuar Putra) #1

Hi guys, so currently i use rasa core version 14.5, and i tried to use form policy where the bot will ask person name from it, and from slot_mappings function:

def slot_mappings(self):
        return {
            "person_name": [
                self.from_text()
            ]
        }

but it doesn’t extract the text, the bot still using the fallback policy, is it the expected behavior? Cause i can’t use from_entity(), NLU cannot extracted 1 word or 2 words name in my model right now, already trained 1 word or 2 words name in the NLU. Thanks!

(Julian Gerhard) #2

Hi @yaput,

I think that you are mentioning several issues. The most important one first:

Could you provide more information about your setup:

  • the rest of the actions.py
  • domain content
  • nlu content

Such that I could really help you?

Regards

(Yanuar Putra) #3

Hi @JulianGerhard thanks for responding, here the setup that i use:

  • custom action form:
class DoctorNameForm(FormAction):
    def name(self):
        # type: () -> Text
        """Unique identifier of the form"""
        return "doctor_name_form"
    
    @staticmethod
    def required_slots(tracker):
        return ['doctor_name']
    
    def slot_mappings(self):
        return {
            "doctor_name": [
                self.from_text()
            ]
        }
    
    def validate_doctor_name(self,value, dispatcher, tracker, domain):
        print(value)
        doctor = doctors.fetchDoctorByName(value)
        if not doctor['status']:
            dispatcher.utter_template('utter_inccorect_doctor', tracker)
            return None
        return {'doctor_name': value}

    def submit(self, dispatcher, tracker, domain):
        lang = tracker.get_slot('language')
        doctor = doctors.fetchDoctorByName(tracker.get_slot("doctor_name"))
        if not doctor['status']:
            dispatcher.utter_template('utter_inccorect_doctor', tracker)
            return
        else:
            if len(doctor['data']) > 0:
                if len(doctor['data']) > 1:
                    te = []
                    for d in doctor['data']:
                        te.append({
                            "title": " دكتور " + d['title_arabic'] if lang == "ar" else "Dr."+ d['title'],
                            "payload": '/selected_doctor{"doctor_name": "'+d['title']+'","doctor_id":"'+d['mediware_id']+'"}'
                        })
                    re = {
                        "type": "quickreplies",
                        "elements": [
                            {
                                "text": "I've found more than one doctor with a similar name. Could you select one from below?" if lang == 'en' else "تم العثور على أكثر من اسم مطابق، رجاءً اختر من القائمة",
                                "replies": te
                            }
                        ]
                    }
                    dispatcher.utter_attachment(re)
                    return []
                else:
                    doctor_data = doctor['data'][0]
                    txt = "Do you mean Dr. "+ doctor_data['title']+"?"
                    if lang == "ar":
                        txt = 'هل تقصد الدكتور '+ doctor_data['title_arabic'] +'؟'
                    replies = {
                        "type": "quickreplies",
                        "elements":[
                            {
                                "text": txt,
                                "replies": [
                                    {
                                        "title": "Yes" if lang != "ar" else "نعم",
                                        "payload": '/agree'
                                    },
                                    {
                                        "title": "No" if lang != "ar" else "لا",
                                        "payload": '/disagree'
                                    }
                                ]
                            }
                        ]
                    }
                    dispatcher.utter_attachment(replies)
                    return [SlotSet("doctor_name", doctor_data['title']), SlotSet("doctor_id", doctor_data['mediware_id'])]
            else:
                dispatcher.utter_template('utter_no_doctor',tracker)
                dispatcher.utter_template('utter_list_appointment_options', tracker)
                return [SlotSet('doctor_name', None)]
  • Domain Content: domain.yml (13.3 KB)

  • nlu content: training.md (41.7 KB)

    sentences with person name as the entity, and using lookup for synonyms(this for intent with the doctor_name or person name itself).

Regards

(Julian Gerhard) #4

Hi,

okay, let’s try something else. Start the bot by running:

rasa run -vv -m <path_to_model> --endpoints endpoints.yml --credentials credentials.yml --enable-api

After that, do a POST request with the body:

{
	"text": "I want to visit Lubab"
}

to

http://localhost:5005/model/parse

and post the result here! We could then at least figure out from where the problem comes.

Besides: Could you show me your stories aswell? The action form seems to be valid.

(Yanuar Putra) #5

Hi, the result for that query:

{
  "entities": [
    {
      "confidence": 0.96602588316061,
      "end": 21,
      "entity": "doctor_name",
      "extractor": "CRFEntityExtractor",
      "start": 16,
      "value": "lubab"
    },
    {
      "confidence": null,
      "end": 21,
      "entity": "PERSON",
      "extractor": "SpacyEntityExtractor",
      "start": 16,
      "value": "Lubab"
    }
  ],
  "intent": {
    "confidence": 0.97358196973801,
    "name": "book_appointment"
  },
  "intent_ranking": [
    {
      "confidence": 0.97358196973801,
      "name": "book_appointment"
    },
    {
      "confidence": 0.086185827851295,
      "name": "career"
    },
    {
      "confidence": 0.057974874973297,
      "name": "closest_centre"
    },
    {
      "confidence": 0.057376191020012,
      "name": "appraisal.bad"
    },
    {
      "confidence": 0.046162117272615,
      "name": "vacancy"
    },
    {
      "confidence": 0.042960979044437,
      "name": "doctor"
    },
    {
      "confidence": 0.038853675127029,
      "name": "symptom_analyzer"
    },
    {
      "confidence": 0.035687454044819,
      "name": "greetings.bye"
    },
    {
      "confidence": 0.035076647996902,
      "name": "agent.annoying"
    },
    {
      "confidence": 0.034582883119583,
      "name": "agent.bad"
    }
  ],
  "model": "current",
  "project": "default",
  "text": "I want to visit Lubab"
}

This is the stories:

## Story Start
* language_selection{"language": "en", "avatar_name": "Leo"} OR language_selection{"language":"ar", "avatar_name": "Mira"} OR language_selection{"language": "en", "avatar_name":"Mira"} OR language_selection{"language": "ar", "avatar_name":"Leo"}
    - utter_introduction_chatbot
    - utter_options_replies
* book_appointment
    - utter_list_appointment_options
* book_appointment_by_doctor
    - doctor_name_form
    - form{"name": "doctor_name_form"}
    - form{"name": null}
* agree
    - action_show_profile_card
* agree
    - action_doctor_locations
* doctor_location{"doctor_location": "Jumeriah", "location_id": "WN"}
    - action_earliest_slot
* agree
    - utter_first_time_user
* agree
    - utter_fill_out_register_form
    - utter_form_register
* submit_register_form{"user_name": "Anton", "user_dob": "14/01/1995", "user_phone": "547657841", "user_email": "test@test.com"}
    - action_otp_sent
* submit_otp{"otp_code": "123456"}
    - action_verify_otp
* rate_good
    - utter_rate_good
    - utter_more_help
    - action_reset_all
* disagree
    - utter_end_conversation


## Story Start
* language_selection{"language": "en", "avatar_name": "Leo"} OR language_selection{"language":"ar", "avatar_name": "Mira"} OR language_selection{"language": "en", "avatar_name":"Mira"} OR language_selection{"language": "ar", "avatar_name":"Leo"}
    - utter_introduction_chatbot
    - utter_options_replies
* book_appointment
    - utter_list_appointment_options
* book_appointment_by_doctor
    - doctor_name_form
    - form{"name": "doctor_name_form"}
    - form{"name": null}
* agree
    - action_show_profile_card
* change_perference OR disagree
    - utter_list_appointment_options
* book_appointment_by_doctor
    - doctor_name_form
    - form{"name": "doctor_name_form"}
    - form{"name": null}
* agree
    - action_show_profile_card
* agree
    - action_doctor_locations
* doctor_location{"doctor_location": "Jumeriah", "location_id": "WN"}
    - action_earliest_slot
* agree
    - utter_first_time_user
* agree
    - utter_fill_out_register_form
    - utter_form_register
* submit_register_form{"user_name": "Anton", "user_dob": "14/01/1995", "user_phone": "547657841", "user_email": "test@test.com"}
    - action_otp_sent
* submit_otp{"otp_code": "123456"}
    - action_verify_otp
* rate_good
    - utter_rate_good
    - utter_more_help
    - action_reset_all
* disagree
    - utter_end_conversation

Thank you for helping :smiley:

(Julian Gerhard) #6

Okay, at least the parsing result is as expected. Can you post your config.yml please? Sorry for forgetting that in my last response.

Regards

(Yanuar Putra) #7

Sure, no worries.

language: "en"
policies:
  - name: KerasPolicy
    epochs: 50
    max_history: 5
  - name: FallbackPolicy
    nlu_threshold: 0.65
    fallback_action_name: 'action_default_fallback'
  - name: MemoizationPolicy
    max_history: 5
  - name: FormPolicy
  - name: MappingPolicy
pipeline:
- name: "nlp_spacy"
- name: "tokenizer_spacy"
# For lookups
- name: "intent_entity_featurizer_regex"
# define our own entity with ner_crf
- name: "ner_crf"
# for extract place, person name, but we don't need it
# if we define our own places, and doctors name
- name: "ner_spacy"
# for extract place, time, curreny entity
# we use this to handle user says: "book appointment tomorrow"
# the drawback is duckling only handle english language as of now
# - name: "ner_duckling_http"
#   url: "http://0.0.0.0:8000"
#   dimensions: ["time", "number", "amount-of-money", "distance", "temperature", "ordinal", "duration", "email", "url", "phone-number"]
#   locale: "en_US"
# help the entity extraction with synomyms: (doctor, Dr., doc, dctr, etc)
- name: "ner_synonyms"
- name: "intent_featurizer_count_vectors"
  analyzer: 'word'
  OOV_words: ['he', 'she', 'it', 'they', 'we', 'i', 'you', 'my', 'your', 'his', 'her', 'us', 'them', 'our', 'their', 'yours', 'its', 'plz', 'please', 'pls', 'plis', 'to', 'are', 'am', 'is']

And also the NLU is doing great, but the problem is whenever the form is activated, then the bot will trigger utter_ask_slot_name for ex: “Can you tell me the doctor’s name?” then the slot_mapping() will use self.from_entity(entity="doctor_name"), then when user type the doctor name: “Lubab”, it will not extract the entity of doctor name, and not intent book_appointment, i assume because it’s a word input.

(Julian Gerhard) #8

Okay, could you please do an experiment:

  1. Backup your stories.md and empty it afterwards. Fill in:
  • book_appointment

    • doctor_name_form
    • slot{“requested_slot”: “doctor_name”}
    • form{“name”: “doctor_name_form”}
    • form{“name”: null}
    • action_restart
  • book_appointment{“doctor_name”: “Lubab”}

    • doctor_name_form
    • form{“name”: “doctor_name_form”}
    • form{“name”: null}
    • action_restart
  1. Modify domain.yml:

Change:

doctor_name:
    type: text

to

doctor_name:
    type: "unfeaturized"
    auto_fill: 0
  1. Change slot mapping

Change

return {
    "doctor_name": [
        self.from_text()
    ]
}

to

return {
    "doctor_name": [
        self.from_entity(entity="doctor_name")
    ]
}
  1. Retrain
  2. Start Action Server and Rasa an say: a. I want to visit a doctor -> Luba b. I want to visit Lubab

and tell me about the results.

(Yanuar Putra) #9

This is the responses: a)

127.0.0.1 - - [2019-06-13 11:40:21] "POST /webhooks/rest/webhook HTTP/1.1" 500 443 0.121835
2019-06-13 11:40:49 DEBUG    rasa_core.tracker_store  - Creating a new tracker for id 'default5'.
2019-06-13 11:40:49 DEBUG    rasa_core.processor  - Received user message 'I want to visit a doctor' with intent '{'name': 'book_appointment', 'confidence': 0.9839223623275757}' and entities '[]'
2019-06-13 11:40:49 DEBUG    rasa_core.processor  - Logged UserUtterance - tracker now has 2 events
2019-06-13 11:40:49 DEBUG    rasa_core.processor  - Current slot values: 
	GPE: None
	LOC: None
	ORG: None
	PERSON: None
	appointment_time: None
	appt_id: None
	avatar_name: None
	body_part: None
	center_name: None
	centre_type: None
	doctor_id: None
	doctor_location: None
	doctor_name: None
	earliest_date: None
	earliest_time: None
	fallback_counter: None
	language: None
	lat: None
	lng: None
	location: None
	location_id: None
	otp_code: None
	patient_id: None
	prefered_date: None
	prefered_time: None
	requested_slot: None
	session_code: None
	severe_scale: None
	specialization: None
	sub_body_part: None
	symptom: None
	symptom_frequency: None
	token_no: None
	user_dob: None
	user_email: None
	user_gender: None
	user_name: None
	user_phone: None
2019-06-13 11:40:49 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, None, None, {}, {'intent_book_appointment': 1.0, 'prev_action_listen': 1.0}]
2019-06-13 11:40:49 DEBUG    rasa_core.policies.memoization  - There is a memorised next action '199'
2019-06-13 11:40:49 DEBUG    rasa_core.policies.form_policy  - There is no active form
2019-06-13 11:40:49 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_MemoizationPolicy
2019-06-13 11:40:49 DEBUG    rasa_core.processor  - Predicted next action 'doctor_name_form' with prob 1.00.
2019-06-13 11:40:49 DEBUG    rasa_core.actions.action  - Calling action endpoint to run action 'doctor_name_form'.
2019-06-13 11:40:49 DEBUG    rasa_core.nlg.callback  - Requesting NLG for utter_ask_doctor_name from http://localhost:5006/nlg.
2019-06-13 11:40:50 DEBUG    rasa_core.processor  - Action 'doctor_name_form' ended with events '['Form(doctor_name_form)', 'SlotSet(key: requested_slot, value: doctor_name)']'
2019-06-13 11:40:50 DEBUG    rasa_core.processor  - Bot utterance 'BotUttered(text: Insert doctor's Name, data: {
  "elements": null,
  "buttons": null,
  "attachment": null
})'
2019-06-13 11:40:50 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, None, None, {}, {'intent_book_appointment': 1.0, 'prev_action_listen': 1.0}]
2019-06-13 11:40:50 DEBUG    rasa_core.policies.memoization  - There is a memorised next action '199'
2019-06-13 11:40:50 DEBUG    rasa_core.policies.form_policy  - There is an active form 'doctor_name_form'
2019-06-13 11:40:50 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_3_FormPolicy
2019-06-13 11:40:50 DEBUG    rasa_core.processor  - Predicted next action 'action_listen' with prob 1.00.
2019-06-13 11:40:50 DEBUG    rasa_core.processor  - Action 'action_listen' ended with events '[]'
127.0.0.1 - - [2019-06-13 11:40:50] "POST /webhooks/rest/webhook HTTP/1.1" 200 200 1.398519
2019-06-13 11:40:54 DEBUG    rasa_core.tracker_store  - Recreating tracker for id 'default5'
2019-06-13 11:40:54 DEBUG    rasa_core.processor  - Received user message 'lubab' with intent '{'name': 'user.needs_advice', 'confidence': 0.5504515171051025}' and entities '[]'
2019-06-13 11:40:54 DEBUG    rasa_core.processor  - Logged UserUtterance - tracker now has 8 events
2019-06-13 11:40:54 DEBUG    rasa_core.processor  - Current slot values: 
	GPE: None
	LOC: None
	ORG: None
	PERSON: None
	appointment_time: None
	appt_id: None
	avatar_name: None
	body_part: None
	center_name: None
	centre_type: None
	doctor_id: None
	doctor_location: None
	doctor_name: None
	earliest_date: None
	earliest_time: None
	fallback_counter: None
	language: None
	lat: None
	lng: None
	location: None
	location_id: None
	otp_code: None
	patient_id: None
	prefered_date: None
	prefered_time: None
	requested_slot: doctor_name
	session_code: None
	severe_scale: None
	specialization: None
	sub_body_part: None
	symptom: None
	symptom_frequency: None
	token_no: None
	user_dob: None
	user_email: None
	user_gender: None
	user_name: None
	user_phone: None
2019-06-13 11:40:54 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, None, None, {}, {'intent_book_appointment': 1.0, 'prev_action_listen': 1.0}]
2019-06-13 11:40:54 DEBUG    rasa_core.policies.memoization  - There is a memorised next action '199'
2019-06-13 11:40:54 DEBUG    rasa_core.policies.fallback  - NLU confidence 0.0 is lower than NLU threshold 0.65. 
2019-06-13 11:40:54 DEBUG    rasa_core.policies.form_policy  - There is an active form 'doctor_name_form'
2019-06-13 11:40:54 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_4_MappingPolicy
2019-06-13 11:40:54 DEBUG    rasa_core.processor  - Predicted next action 'action_default_fallback' with prob 1.00.
2019-06-13 11:40:54 DEBUG    rasa_core.actions.action  - Calling action endpoint to run action 'action_default_fallback'.
2019-06-13 11:40:54 DEBUG    rasa_core.nlg.callback  - Requesting NLG for utter_default_failure from http://localhost:5006/nlg.
2019-06-13 11:40:55 DEBUG    rasa_core.processor  - Action 'action_default_fallback' ended with events '['SlotSet(key: fallback_counter, value: 1)']'
2019-06-13 11:40:55 DEBUG    rasa_core.processor  - Bot utterance 'BotUttered(text: Hmm... I don't understand what you mean. Why don't you check the main menu for support or re-enter your question?, data: {
  "elements": null,
  "buttons": null,
  "attachment": null
})'
2019-06-13 11:40:55 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, None, None, {}, {'intent_book_appointment': 1.0, 'prev_action_listen': 1.0}]
2019-06-13 11:40:55 DEBUG    rasa_core.policies.memoization  - There is a memorised next action '199'
2019-06-13 11:40:55 DEBUG    rasa_core.policies.form_policy  - There is an active form 'doctor_name_form'
2019-06-13 11:40:55 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_2_FallbackPolicy
2019-06-13 11:40:55 DEBUG    rasa_core.processor  - Predicted next action 'action_listen' with prob 1.00.
2019-06-13 11:40:55 DEBUG    rasa_core.processor  - Action 'action_listen' ended with events '[]'

b)

127.0.0.1 - - [2019-06-13 11:40:55] "POST /webhooks/rest/webhook HTTP/1.1" 200 294 0.868707
2019-06-13 11:45:17 DEBUG    rasa_core.tracker_store  - Recreating tracker for id 'default'
2019-06-13 11:45:17 DEBUG    rasa_core.processor  - Received user message 'I want to visit Lubab' with intent '{'name': 'book_appointment', 'confidence': 0.9735819697380066}' and entities '[{'start': 16, 'end': 21, 'value': 'lubab', 'entity': 'doctor_name', 'confidence': 0.9660258831606064, 'extractor': 'CRFEntityExtractor'}, {'entity': 'PERSON', 'value': 'Lubab', 'start': 16, 'confidence': None, 'end': 21, 'extractor': 'SpacyEntityExtractor'}]'
2019-06-13 11:45:17 DEBUG    rasa_core.processor  - Logged UserUtterance - tracker now has 3 events
2019-06-13 11:45:17 DEBUG    rasa_core.processor  - Current slot values: 
	GPE: None
	LOC: None
	ORG: None
	PERSON: Lubab
	appointment_time: None
	appt_id: None
	avatar_name: None
	body_part: None
	center_name: None
	centre_type: None
	doctor_id: None
	doctor_location: None
	doctor_name: None
	earliest_date: None
	earliest_time: None
	fallback_counter: None
	language: None
	lat: None
	lng: None
	location: None
	location_id: None
	otp_code: None
	patient_id: None
	prefered_date: None
	prefered_time: None
	requested_slot: None
	session_code: None
	severe_scale: None
	specialization: None
	sub_body_part: None
	symptom: None
	symptom_frequency: None
	token_no: None
	user_dob: None
	user_email: None
	user_gender: None
	user_name: None
	user_phone: None
2019-06-13 11:45:17 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, None, None, {}, {'entity_doctor_name': 1.0, 'entity_PERSON': 1.0, 'intent_book_appointment': 1.0, 'prev_action_listen': 1.0, 'slot_PERSON_0': 1.0}]
2019-06-13 11:45:17 DEBUG    rasa_core.policies.memoization  - There is no memorised next action
2019-06-13 11:45:17 DEBUG    rasa_core.policies.form_policy  - There is no active form
2019-06-13 11:45:17 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_0_KerasPolicy
2019-06-13 11:45:17 DEBUG    rasa_core.processor  - Predicted next action 'doctor_name_form' with prob 0.52.
2019-06-13 11:45:17 DEBUG    rasa_core.actions.action  - Calling action endpoint to run action 'doctor_name_form'.
2019-06-13 11:45:23 DEBUG    rasa_core.processor  - Action 'doctor_name_form' ended with events '['Form(doctor_name_form)', 'SlotSet(key: doctor_name, value: lubab)', 'SlotSet(key: doctor_name, value: Lubab Jassim Mohammed)', 'SlotSet(key: doctor_id, value: L001)', 'Form(None)', 'SlotSet(key: requested_slot, value: None)']'
2019-06-13 11:45:23 WARNING  rasa_core.processor  - Action 'doctor_name_form' set a slot type 'doctor_id' that it never set during the training. This can throw of the prediction. Make sure to include training examples in your stories for the different types of slots this action can return. Remember: you need to set the slots manually in the stories by adding '- slot{"doctor_id": "L001"}' after the action.
2019-06-13 11:45:23 DEBUG    rasa_core.processor  - Bot utterance 'BotUttered(text: None, data: {
  "elements": null,
  "buttons": null,
  "attachment": null
})'
2019-06-13 11:45:23 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, None, {}, {'entity_doctor_name': 1.0, 'entity_PERSON': 1.0, 'intent_book_appointment': 1.0, 'prev_action_listen': 1.0, 'slot_PERSON_0': 1.0}, {'entity_doctor_name': 1.0, 'entity_PERSON': 1.0, 'intent_book_appointment': 1.0, 'slot_doctor_id_0': 1.0, 'prev_doctor_name_form': 1.0, 'slot_PERSON_0': 1.0}]
2019-06-13 11:45:23 DEBUG    rasa_core.policies.memoization  - There is no memorised next action
2019-06-13 11:45:23 DEBUG    rasa_core.policies.form_policy  - There is no active form
2019-06-13 11:45:23 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_0_KerasPolicy
2019-06-13 11:45:23 DEBUG    rasa_core.processor  - Predicted next action 'action_restart' with prob 0.58.
2019-06-13 11:45:23 DEBUG    rasa_core.actions.action  - Calling action endpoint to run action 'action_restart'.
2019-06-13 11:45:23 DEBUG    rasa_core.processor  - Action 'action_restart' ended with events '['Restarted()', 'SlotSet(key: language, value: None)', 'SlotSet(key: avatar_name, value: None)']'
2019-06-13 11:45:23 WARNING  rasa_core.processor  - Action 'action_restart' set a slot type 'language' that it never set during the training. This can throw of the prediction. Make sure to include training examples in your stories for the different types of slots this action can return. Remember: you need to set the slots manually in the stories by adding '- slot{"language": null}' after the action.
2019-06-13 11:45:23 WARNING  rasa_core.processor  - Action 'action_restart' set a slot type 'avatar_name' that it never set during the training. This can throw of the prediction. Make sure to include training examples in your stories for the different types of slots this action can return. Remember: you need to set the slots manually in the stories by adding '- slot{"avatar_name": null}' after the action.
2019-06-13 11:45:23 DEBUG    rasa_core.processor  - Predicted next action 'action_listen' with prob 1.00.
2019-06-13 11:45:23 DEBUG    rasa_core.processor  - Action 'action_listen' ended with events '[]'

It doesn’t recognize the 1 word input such as person name, maybe i need to configure it somewhere?

(Julian Gerhard) #10

Hey,

it worked as expected - I think you typed in “Luba” instead of “Lubab” in the first sample. In the second example you see, that it triggers the form, extracts the entity and finished the form without a proper utterance - but only because there is none defined - you could do that if you want to, some do it with “utter_slot_values”.

I think the main problem lies in your story design you previously posted. Your training and extraction works fine. If you define an entity the way you did it, the problem won’t ever be 1 or 2 words…

Regards

1 Like
(Yanuar Putra) #11

Oh yes, i also tried it again with ‘Lubab’ and same result and no entities extracted 2019-06-13 11:40:54 DEBUG rasa_core.processor - Received user message 'lubab' with intent '{'name': 'user.needs_advice', 'confidence': 0.5504515171051025}' and entities '[]'

(Yanuar Putra) #12

I tried with self.from_text() but FallbackPolicy takes over when the NLU threshold is not meet and action_default_fallback triggered.

(rianne) #13

@yaput Did you try to add some more one / two words examples to your NLU? Are the one/two word examples that are explicitly defined in your NLU (anna Jacob e.g.) working?

(Yanuar Putra) #14

Hi @rbossie , yup, bot only for some name only, not all of them, cause i’m hopping rasa nlu will query it from lookup file, but after i add more to the training data like: anna, jacob, ali only, and it’s working now.

So the answer for my issue is: add the entity to the training data(peter, jacob, anna, etc). Once it’s added, then NLU will recognize it.

(rianne) #15

I guess there needs to be some sort of balance there, according to the following notion in the Rasa docs: Training Data Format (bottom of the page)

For lookup tables to be effective, there must be a few examples of matches in your training data. Otherwise the model will not learn to use the lookup table match features.

So I would suggest to play with the number of examples defined in the NLU to get the right amount of examples and still profit from the lookup table

1 Like
(Yanuar Putra) #16

Yup, noticed about that, like you said, i have to play with the number of examples. Thanks for your help. Cheers :smiley: