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