Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Commit

Permalink
validate both entities and intent
Browse files Browse the repository at this point in the history
  • Loading branch information
paulaWesselmann committed Mar 4, 2019
1 parent 18f8e86 commit 70f1066
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions rasa_core/training/interactive.py
Expand Up @@ -997,15 +997,23 @@ def _validate_user_text(latest_message: Dict[Text, Any],
parse_data = latest_message.get("parse_data", {})
text = _as_md_message(parse_data)
intent = parse_data.get("intent", {}).get("name")
entities = parse_data.get("entities", [])
if entities:
entity = []
for e in entities:
entity.append('[' + e['value'] + '](' + e['entity'] + ')')
else:
entity = "'None'"

if intent is None:
print("The NLU classification for '{}' returned '{}'"
"".format(text, intent))
return False
else:
question = questionary.confirm(
"Is the NLU classification for '{}' with intent '{}' correct?"
"".format(text, intent))
"Is the NLU classification for '{}' with intent '{}' "
"and entities: {} correct?"
"".format(text, intent, entity))

return _ask_or_abort(question, sender_id, endpoint)

Expand Down

0 comments on commit 70f1066

Please sign in to comment.