Testy skadnikow i ilosci

This commit is contained in:
s495727 2024-06-13 17:44:59 +02:00
parent 73b9e52d31
commit bf309fb6fe

View File

@ -146,15 +146,26 @@ 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(value) new_order[slot.name].append({"name": value, "quantity": 1, "ingredient": [], "neg/ingredient": []})
else: else:
new_order[slot.name] = [value] new_order[slot.name] = [{"name": value, "quantity": 1, "ingredient": [], "neg/ingredient": []}]
elif slot.name == "drink": elif slot.name == "drink":
if new_order.get("drink"): if new_order.get("drink"):
new_order[slot.name].append(value) new_order[slot.name].append({"drink": value, "quantity": 1})
else: else:
new_order[slot.name] = [value] new_order[slot.name] = [{"drink": value, "quantity": 1}]
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":
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)