Slots, text - Getting Started with Rasa / Tutorials, Resources & Videos - Rasa Community Forum
👋 Introducing the Rasa Playground
Slots, text
post by Candia on Sep 28, 2020
Hi everyone
can someone help me with a question?
I am working with forms and slots, and I want to save the text entered by the user in a slot of the form, how can I do it?
post by UlisesVD on Sep 28, 2020
with this in the slotmapping
return {
“your_entity”: self.from_text(intent=“your_intent”)
}
post by Candia on Sep 29, 2020
thanks for your answer!.
but being data of an address?
does it have to be added in my entities?
post by UlisesVD on Sep 29, 2020
you can give me an example?
post by Candia on Sep 30, 2020
thanks for your time
I need to save a text written by the user when filling the form. being this the address of your home, example: mallorca # 1219
and I can’t have all the directions in one intent
post by UlisesVD on Oct 1, 2020
yes just make an intent inform like this:
## intent:inform
- [el casique #45] (address)
- [lomas de oriente #89] (address)
- [pueblita #45] (address)
- [hidalgo #78] (address)
with more examples of course
in your domain file you need:
intents:
- inform
- "all:your_others_intents"
entities:
- address
- "all:your_others_entities"
slots:
address:
type: unfeaturized
"all_your_others_entities"
responses:
utter_ask_address:
- text: "What is your address??"
forms:
- your_form_name
in your actions.py
class RegisterAddress(FormAction):
def name(self):
return "your_form_name"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
"""A list of required slots that the form has to fill"""
list_slots = ["address"]
return list_slots
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict[Text, Any]]]]:
"""A dictionary to map required slots to
- an extracted entity
- intent: value pairs
- a whole message
or a list of them, where a first match will be picked"""
return {
"address": self.from_text(intent="inform"),
}
def submit(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any],) -> List[Dict]:
address = tracker.get_slot('address')
dispatcher.utter_message(f" \
address: {address}\n ")
return []
post by Candia on Oct 1, 2020
thank you very much for your help.
Currently I have it configured like this, but seeing that there are millions of streets in my city, it would be something too difficult to handle, you can get the intent of an API right?
adding that each street has approximately 200 possible house numbers
post by UlisesVD on Oct 2, 2020
I don’t sure about it, but why do you want to have all the streets of your city in rasa??
post by Candia on Oct 2, 2020
that’s why I need to add to the rasa slot without validating the information (intent), only the message prior to the time of filling the form
post by UlisesVD on Oct 3, 2020
you don’t need to put all of the existent address just need to put some real example and rasa must learn to detect an address even if this address is not in the examples.
check this I think is what you need
the part of Entities Roles and Groups
post by Candia on Oct 4, 2020
what I was looking for !!!
thanks for your help (Y)