|
20 | 20 | ACTION_NAME_SENDER_ID_CONNECTOR_STR,
|
21 | 21 | USER_INTENT_RESTART,
|
22 | 22 | UTTER_PREFIX,
|
| 23 | + USER_INTENT_BACK, |
| 24 | + USER_INTENT_OUT_OF_SCOPE, |
23 | 25 | )
|
24 | 26 | from rasa.core.domain import Domain
|
25 | 27 | from rasa.core.events import (
|
@@ -289,17 +291,28 @@ def _log_slots(tracker):
|
289 | 291 | logger.debug(f"Current slot values: \n{slot_values}")
|
290 | 292 |
|
291 | 293 | def _log_unseen_features(self, parse_data: Dict[Text, Any]) -> None:
|
292 |
| - """Check if the NLU interpreter picks up intents or entities that aren't in the domain.""" |
| 294 | + """Check if the NLU interpreter picks up intents or entities that aren't recognized.""" |
293 | 295 |
|
294 | 296 | domain_is_not_empty = self.domain and not self.domain.is_empty()
|
| 297 | + |
| 298 | + default_intents = [ |
| 299 | + USER_INTENT_RESTART, |
| 300 | + USER_INTENT_BACK, |
| 301 | + USER_INTENT_OUT_OF_SCOPE, |
| 302 | + ] |
| 303 | + |
295 | 304 | intent = parse_data["intent"]["name"]
|
296 |
| - if intent and domain_is_not_empty and intent not in self.domain.intents: |
297 |
| - warnings.warn( |
298 |
| - f"Interpreter parsed an intent '{intent}' " |
299 |
| - "that is not defined in the domain." |
300 |
| - ) |
| 305 | + if intent: |
| 306 | + intent_is_recognized = ( |
| 307 | + domain_is_not_empty and intent in self.domain.intents |
| 308 | + ) or intent in default_intents |
| 309 | + if not intent_is_recognized: |
| 310 | + warnings.warn( |
| 311 | + f"Interpreter parsed an intent '{intent}' " |
| 312 | + "that is not defined in the domain." |
| 313 | + ) |
301 | 314 |
|
302 |
| - entities = parse_data["entities"] |
| 315 | + entities = parse_data["entities"] or [] |
303 | 316 | for element in entities:
|
304 | 317 | entity = element["entity"]
|
305 | 318 | if entity and domain_is_not_empty and entity not in self.domain.entities:
|
|
0 commit comments