Skip to content
Snippets Groups Projects
Unverified Commit 4c3d02fc authored by Christian Geishauser's avatar Christian Geishauser Committed by GitHub
Browse files

changed masking such that it works also if belief state has less keys… (#105)


* changed masking such that it works also if belief state has less keys then default state

* Update vector_base.py

Co-authored-by: default avatarChristian <christian.geishauser@hhu.de>
Co-authored-by: default avatarCarel van Niekerk <40663106+carelvniekerk@users.noreply.github.com>
parent 31d31113
Branches
No related tags found
No related merge requests found
......@@ -259,11 +259,12 @@ class VectorBase(Vector):
if intent in ['nobook', 'nooffer'] and slot != 'none':
mask_list[i] = 1.0
if "book" in slot and intent == 'inform' and not self.state[domain][slot]:
if "book" in slot and intent == 'inform':
if not self.state.get(domain, {}).get(slot, {}):
mask_list[i] = 1.0
if domain == 'taxi':
if slot in self.state['taxi']:
if slot in self.state.get('taxi', {}):
if not self.state['taxi'][slot] and intent == 'inform':
mask_list[i] = 1.0
......@@ -315,7 +316,7 @@ class VectorBase(Vector):
entities list:
list of entities of the specified domain
"""
constraints = self.state[domain]
constraints = self.state.get(domain, {})
# Leave slots out of constraints to find which slot constraint results in no entities being found
for constraint_slot in constraints:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment