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

fixed domain configuration access to intents #850

Merged
merged 1 commit into from Aug 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion rasa_core/domain.py
Expand Up @@ -233,7 +233,8 @@ def get_parsing_states(self, tracker):
# be ignored for the current intent
for entity in tracker.latest_message.entities:
intent_name = tracker.latest_message.intent.get("name")
should_use_entity = self._intents[intent_name]['use_entities']
intent_config = self.intent_config(intent_name)
should_use_entity = intent_config.get('use_entities', True)
if should_use_entity:
key = "entity_{0}".format(entity["entity"])
state_dict[key] = 1.0
Expand Down Expand Up @@ -381,6 +382,11 @@ def intents(self):
raise NotImplementedError(
"domain must provide a list of intents")

def intent_config(self, intent_name):
# type: (Text) -> Dict[Text, Any]
"""Return the configuration for an intent."""
return {}

@abc.abstractproperty
def actions(self):
# type: () -> List[Action]
Expand Down Expand Up @@ -553,6 +559,11 @@ def slots(self):
def intents(self):
return sorted(self._intents.keys())

def intent_config(self, intent_name):
# type: (Text) -> Dict[Text, Any]
"""Return the configuration for an intent."""
return self._intents.get(intent_name, {})

@utils.lazyproperty
def entities(self):
return self._entities
Expand Down