slots = []
for regex in self.regexes_per_intent[intent]:
match = regex.match(text)
if match is None:
continue
for group_name in match.groupdict():
slot_name = self.group_names_to_slot_names[group_name]
entity = self.slot_names_to_entities[slot_name]
rng = (match.start(group_name), match.end(group_name))
parsed_slot = ParsedSlot(match_range=rng,
value=match.group(group_name),
entity=entity,
slot_name=slot_name)
slots.append(parsed_slot)
After Change
res = self._cache[text]
if intent is not None and res.parsed_intent is not None and \
res.parsed_intent.intent_name != intent:
return []
return res.parsed_slots
def _parse(self, text):
if not self.fitted: