Skip to content

Commit

Permalink
Refactor DialogueStateTracker.update_state_user
Browse files Browse the repository at this point in the history
Fixes #201
  • Loading branch information
NoB0 committed Aug 29, 2023
1 parent 796eb67 commit d1d5961
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 215 deletions.
7 changes: 4 additions & 3 deletions moviebot/dialogue_manager/dialogue_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""


from collections import defaultdict
from copy import deepcopy
from typing import Any, Dict, List

Expand All @@ -33,7 +34,7 @@ def __init__(
# self.requestable_slots_filled = {}
self.agent_requestable = deepcopy(self.ontology.agent_requestable)
self.user_requestable = deepcopy(self.ontology.user_requestable)
self.frame_CIN = dict.fromkeys(slots) # user requirements before
self.frame_CIN = defaultdict.fromkeys(slots) # user requirements before
# making a recommendation. CIN stands for current information needs
self.frame_PIN = (
{}
Expand All @@ -45,7 +46,7 @@ def __init__(
self.last_user_dacts: List[DialogueAct] = None # the current user act

# Keep track of the recommended movies
self.movies_recommended = {}
self.movies_recommended = defaultdict(list)

def _agent_offer_state(self) -> str:
"""Returns string representation of the agent's offer state."""
Expand Down Expand Up @@ -103,7 +104,7 @@ def initialize(self) -> None:
# the recommended movie and all it's attributes from the database
self.item_in_focus = None
self.items_in_context = False
self.movies_recommended = {}
self.movies_recommended = defaultdict(list)

self.agent_requestable = deepcopy(self.ontology.agent_requestable)
self.user_requestable = deepcopy(self.ontology.user_requestable)
Expand Down
Loading

0 comments on commit d1d5961

Please sign in to comment.