Testing
This commit is contained in:
parent
118099bb37
commit
02312cc3b9
@ -70,18 +70,14 @@ class DialogStateMonitor:
|
||||
|
||||
if stage['name'] == "collect_food":
|
||||
for order in self.state['belief_state']['order']:
|
||||
for o in order:
|
||||
k, v = o
|
||||
if k == 'pizza':
|
||||
stage['completed'] = True
|
||||
return
|
||||
if order.get("pizza"):
|
||||
stage['completed'] = True
|
||||
return
|
||||
elif stage["name"] == "collect_drinks":
|
||||
for order in self.state['belief_state']['order']:
|
||||
for o in order:
|
||||
k, v = o
|
||||
if k == 'drink':
|
||||
stage['completed'] = True
|
||||
return
|
||||
if order.get("drink"):
|
||||
stage['completed'] = True
|
||||
return
|
||||
elif stage["name"] == "collect_address":
|
||||
if not len(self.state['belief_state']['address']):
|
||||
return
|
||||
@ -129,7 +125,7 @@ class DialogStateMonitor:
|
||||
if frame.source != 'user':
|
||||
return
|
||||
if frame.act == 'inform/order':
|
||||
new_order = list()
|
||||
new_order = dict()
|
||||
for slot in frame.slots:
|
||||
value = normalize(slot.value)
|
||||
slot = self.slot_augmentation(slot, value)
|
||||
@ -146,7 +142,11 @@ class DialogStateMonitor:
|
||||
return
|
||||
self.state['was_previous_order_invalid'] = False
|
||||
self.state['total_cost'] += self.state['constants'][slot.name][value]['price']
|
||||
new_order.append((slot.name, value))
|
||||
if slot.name == "pizza":
|
||||
if new_order.get("pizza"):
|
||||
new_order[slot.name].append(value)
|
||||
else:
|
||||
new_order[slot.name] = [value]
|
||||
if len(new_order) > 0:
|
||||
self.state['belief_state']['order'].append(new_order)
|
||||
self.complete_stage_if_valid('collect_food')
|
||||
|
Loading…
Reference in New Issue
Block a user