Fix deocde

This commit is contained in:
pkufool 2023-11-16 11:41:29 +08:00
parent cba104a29d
commit a7cb40a0a0
3 changed files with 5 additions and 5 deletions

View File

@ -927,9 +927,9 @@ def main():
if os.path.exists(params.context_file):
contexts = []
for line in open(params.context_file).readlines():
contexts.append(line.strip())
contexts.append((sp.encode(line.strip()), 0.0))
context_graph = ContextGraph(params.context_score)
context_graph.build(sp.encode(contexts))
context_graph.build(contexts)
else:
context_graph = None
else:

View File

@ -1001,9 +1001,9 @@ def main():
if os.path.exists(params.context_file):
contexts = []
for line in open(params.context_file).readlines():
contexts.append(line.strip())
contexts.append((sp.encode(line.strip()), 0.0))
context_graph = ContextGraph(params.context_score)
context_graph.build(sp.encode(contexts))
context_graph.build(contexts)
else:
context_graph = None
else:

View File

@ -868,7 +868,7 @@ def main():
contexts_text.append(line.strip())
contexts = graph_compiler.texts_to_ids(contexts_text)
context_graph = ContextGraph(params.context_score)
context_graph.build(contexts)
context_graph.build([(c, 0.0) for c in contexts])
else:
context_graph = None
else: