Yes,It loses NER capabilities. As I want to mention here It can be done in multiple approaches. For now I added logic in the required slots function so that it uses single entity to fulfill different slots
Class CountryForm(FormAction):
def name(self) -> Text:
return "CountryForm"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
"""A list of required slots that the form has to fill"""
if (tracker.get_slot('currentlocation') is None):
return ["currentlocation"]
else:
return ["destination"]
def slot_mappings(self) -> Dict[Text, Any]:
return {
"currentlocation": self.from_entity(entity="country", intent= "currentlocation"),
"destination": self.from_entity(entity="country", intent="currentlocation")
}
def submit(self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict]:
current = tracker.get_slot('currentlocation')
des = tracker.get_slot('destination')
#Testing purpose
dispatcher.utter_message("I am from {} and I want to go to {}".format(current, des))
return []
nlu.md
## intent:currentlocation
- I am from [sweden](country)
- I want to go [Estonia](country)
- I am from [UK](country)
- I am from [Russia](country)
- I want to go [United States](country)
- I want to go [sweden](country)
- I want to go [UK](country)
- I am from [Estonia](country)