Fix dialogue state reset
This commit is contained in:
parent
60c68015f7
commit
7b4095e39e
@ -1,8 +1,8 @@
|
|||||||
import jsgf
|
import jsgf
|
||||||
from os import listdir
|
from os import listdir
|
||||||
from os.path import isfile, join
|
from os.path import isfile, join, dirname, abspath
|
||||||
|
|
||||||
mypath = "../semantic_parser/gramatics/"
|
mypath = dirname(abspath(__file__)) + "/../semantic_parser/gramatics/"
|
||||||
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
|
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
|
||||||
|
|
||||||
grammars = []
|
grammars = []
|
||||||
|
@ -60,9 +60,7 @@ def incr_counter(dialogue_state):
|
|||||||
current_val = dialogue_state['counter']
|
current_val = dialogue_state['counter']
|
||||||
dialogue_state['counter'] = current_val + 1
|
dialogue_state['counter'] = current_val + 1
|
||||||
|
|
||||||
def reset_state_if_needed(frame):
|
def reset_state_if_needed(frame, dialogue_state):
|
||||||
global iterator
|
|
||||||
if frame['act'] == "hello" or frame['act'] == "bye":
|
if frame['act'] == "hello" or frame['act'] == "bye":
|
||||||
dialogue_state.clear()
|
dialogue_state['topics'] = []
|
||||||
iterator = 1
|
dialogue_state['counter'] = 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user