Hi All, I’m very new to RASA and struck with Entity Extraction for getting the username.Please someone help me out to solve this issue.
In below, I’ll provide my things which is used. The version I’m using is 3.1 nlu.yml :
nlu:
- intent: CallUser
examples: |
- Call [Alice]{“entity”:“user”,“value”:“Alice”}
- Dial [Bob]{“entity”:“user”,“value”:“Bob”}
- Make a voice call to [Charlie]{“entity”:“user”,“value”:“Charlie”}
- I want to make call to [Charlie]{“entity”:“user”,“value”:“Charlie”}
domain.yml:
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- CallUser
entities:
- user actions:
- action_make_voice_call
rules.yml:
- rule: making voice calling
steps:
- intent: CallUser
- action: action_make_voice_call
config.yml:
language: en
pipeline:
- name: SpacyNLP
model: “en_core_web_md”
case_sensitive: False
-
name: WhitespaceTokenizer
-
name: RegexFeaturizer
-
name: RegexEntityExtractor
-
name: LexicalSyntacticFeaturizer
-
name: CountVectorsFeaturizer
-
name: CountVectorsFeaturizer
analyzer: “char_wb”
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 100
entity_recognition: True
-
name: EntitySynonymMapper
-
name: ResponseSelector
epochs: 100
- name: SpacyEntityExtractor
dimensions: [“user”]
- name: FallbackClassifier
threshold: 0.3
ambiguity_threshold: 0.1
policies:
-
name: MemoizationPolicy
-
name: RulePolicy
-
name: TEDPolicy
max_history: 5
epochs: 100
assistant_id: 20230906-202242-naive-meat
actions.py
from typing import Any, Text, Dict, List from rasa_sdk import Action, Tracker from rasa_sdk.executor import CollectingDispatcher
class ActionMakeVoiceCall(Action): def name(self) → Text: return “action_make_voice_call”
def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
print(tracker.get_latest_entity_values)
user_entity = next(tracker.get_latest_entity_values("user"), None)
print("user_entity",user_entity)
if user_entity:
dispatcher.utter_message(text=f"Calling {user_entity} now")
else:
dispatcher.utter_message(text="User name not provided.")
return []
I hope that provided all the codes what ever I’ve used it. Please correct me!