Testy skadnikow i ilosci

This commit is contained in:
s495727 2024-06-13 17:59:02 +02:00
parent 05876dbd24
commit 9c528afc6c

View File

@ -45,7 +45,7 @@ class DialogStateMonitor:
was_system_act_processed=False,
constants=constants,
history=[],
system_history=[]
system_history=[],
)
self.state = copy.deepcopy(self.__initial_state)
@ -146,27 +146,22 @@ class DialogStateMonitor:
self.state['total_cost'] += self.state['constants'][slot.name][value]['price']
if slot.name == "pizza":
if new_order.get("pizza"):
new_order[slot.name].append({"name": value, "quantity": 1, "ingredient": [], "neg/ingredient": []})
new_order[slot.name].append({"name": value, "ingredient": [], "ingredient/neg": []})
else:
new_order[slot.name] = [{"name": value, "quantity": 1, "ingredient": [], "neg/ingredient": []}]
new_order[slot.name] = [{"name": value, "ingredient": [], "ingredient/neg": []}]
elif slot.name == "drink":
if new_order.get("drink"):
new_order[slot.name].append({"drink": value, "quantity": 1})
new_order[slot.name].append({"drink": value})
else:
new_order[slot.name] = [{"drink": value, "quantity": 1}]
new_order[slot.name] = [{"drink": value}]
elif slot.name in ["ingredient", "neg/ingredient"]:
last_order = self.state['belief_state']['order'][-1]
if last_order["name"] == "pizza":
last_order[slot.name].append(value)
elif last_order["name"] == "drink":
last_order[slot.name].append(value)
elif slot.name == "quantity":
last_order = self.state['belief_state']['order'][-1]
if last_order["name"] == "pizza":
last_order[slot.name] = value
elif last_order["name"] == "drink":
last_order[slot.name] = value
if len(self.state['belief_state']['order']) != 0:
last_order = self.state['belief_state']['order'][-1]
if last_order["name"] == "pizza":
last_order[slot.name].append(value)
elif last_order["name"] == "drink":
last_order[slot.name].append(value)
if len(new_order) > 0:
self.state['belief_state']['order'].append(new_order)