Skip to content

Commit

Permalink
some tiny fix
Browse files Browse the repository at this point in the history
  • Loading branch information
luotao1 committed Dec 6, 2016
1 parent 737f2bf commit 16bebc4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 437 deletions.
25 changes: 12 additions & 13 deletions demo/seqToseq/dataprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,20 @@ def hook(settings, src_dict_path, trg_dict_path, is_generating, file_list,
# job_mode = 1: training mode
# job_mode = 0: generating mode
settings.job_mode = not is_generating
settings.src_dict = dict()
with open(src_dict_path, "r") as fin:
settings.src_dict = {
line.strip(): line_count
for line_count, line in enumerate(fin)
}
settings.trg_dict = dict()
with open(trg_dict_path, "r") as fin:
settings.trg_dict = {
line.strip(): line_count
for line_count, line in enumerate(fin)
}

def fun(dict_path):
out_dict = dict()
with open(dict_path, "r") as fin:
out_dict = {
line.strip(): line_count
for line_count, line in enumerate(fin)
}
return out_dict

settings.src_dict = fun(src_dict_path)
settings.trg_dict = fun(trg_dict_path)

settings.logger.info("src dict len : %d" % (len(settings.src_dict)))
settings.sample_count = 0

if settings.job_mode:
settings.slots = {
Expand Down
Loading

0 comments on commit 16bebc4

Please sign in to comment.