I am trying to make a train help bot that tells trains between 2 particular stations as slots Source and Destination. Both slots take the same type of values ie. a station name, the same value can be source or Destination given its position. The form works fine when i give both slots in the same query like -
Search trains from [Delhi](Source) to [mumbai](Destination).
Search trains from [Mumbai](Source) to [delhi](Destination).
however if I give 1 slot at a time it overwrites the previous values. Same code works in rasa 1.8.3 with sklearn pipeline
language: "en"
pipeline:
- name: "SpacyNLP"
- name: "SpacyTokenizer"
- name: "SpacyFeaturizer"
- name: "RegexFeaturizer"
- name: "CRFEntityExtractor"
- name: "EntitySynonymMapper"
- name: "SklearnIntentClassifier"
policies:
- name: MemoizationPolicy
- name: FormPolicy
- name: TEDPolicy
max_history: 5
epochs: 50
- name: MappingPolicy
however when i use following diet classifier pipeline slots override
language: en
pipeline:
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
analyzer: "char_wb"
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 50
- name: EntitySynonymMapper
- name: ResponseSelector
epochs: 100
output-
PNBE and NDLS are code for stations for api call. I am using rasa forms: class TrainSearch(FormAction):
def name(self) -> Text:
return 'train_form'
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
return ["Source","Destination"]
def validate_Source(
self,
value: Text,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> Dict[Text, Any]:
"""Validate Source slot value"""
if value:
# print("Validating source for train search, source: ",value)
sour = codes(value)
value = sour
# print("Validation source done, Source: ",value)
return {"Source": value}
else:
dispatcher.utter_message(template="utter_wrong_Source")
return {"Source": None}
def validate_Destination(
self,
value: Text,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> Dict[Text, Any]:
"""Validate Destination slot value."""
if value:
# print("Validating Destination for train search, Destination: ",value)
dest =codes(value)
value = dest
# print("Validation destination done, Source: ",value)
return {"Destination": value}
else:
dispatcher.utter_message(template="utter_wrong_Destination")
return {"Destination": None}
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
return {"Source": [self.from_entity(entity="Source"), self.from_entity(entity="location")],
"Destination": [self.from_entity(entity="Destination"), self.from_entity(entity="location")]
}
nlu looks like
## intent:train_search
- search trains
- to [delhi](destination)
- from [delhi](source)
- Search trains from [pnbe](source)
- Search trains to [pnbe](destination)
- Search trains from [new delhi](source) to [patna junction](destination)
- Search trains from [patna](source) to [delhi](destination)
- Search trains from [ndls](source) to [pnbe](destination)
## intent:inform
- [NDLS](location)
- [MB](location)
- [LJN](location)
- [Ajmer Junction](location)
- [MSH](location)
- [GAYA](location)
- [Gaya](location)
- [gaya](location)
- [AZI](location)
- [Chennai Central](location)
## lookup:location
C:\\Users\\rxjos\\Desktop\\bot\\records\\stations.txt
## lookup:Source
C:\\Users\\rxjos\\Desktop\\bot\\records\\stations.txt
## lookup:Destination
C:\\Users\\rxjos\\Desktop\\bot\\records\\stations.txt
record is a file with all valid station names and words in list.