Skip to content

Commit

Permalink
raise exception if intent name contains a slash
Browse files Browse the repository at this point in the history
  • Loading branch information
m-vdb committed Jul 21, 2020
1 parent 2e2f190 commit 64098f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rasa/nlu/training_data/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,17 @@ def get_combined_intent_response_key(self) -> Text:
@staticmethod
def separate_intent_response_key(
original_intent: Text,
) -> Tuple[Optional[Text], Optional[Text]]:
) -> Tuple[Text, Optional[Text]]:

split_title = original_intent.split(RESPONSE_IDENTIFIER_DELIMITER)
if len(split_title) == 2:
return split_title[0], split_title[1]
elif len(split_title) == 1:
return split_title[0], None
return None, None

raise RasaException(
f"Intent name is invalid, it should not contain '{RESPONSE_IDENTIFIER_DELIMITER}'."
)

def get_sparse_features(
self, attribute: Text, featurizers: Optional[List[Text]] = None
Expand Down

0 comments on commit 64098f6

Please sign in to comment.