提交 a2668240 编写于 作者: Q qiuxuezhong

rename files

上级 67832a8c
......@@ -26,14 +26,9 @@ def parse_args():
'--prepare',
action='store_true',
help='create the directories, prepare the vocabulary and embeddings')
parser.add_argument('--train', action='store_true', help='train the model')
parser.add_argument(
'--train',
action='store_true',
help='train the model')
parser.add_argument(
'--evaluate',
action='store_true',
help='evaluate the model on dev set')
'--evaluate', action='store_true', help='evaluate the model on dev set')
parser.add_argument(
'--predict',
action='store_true',
......@@ -96,55 +91,19 @@ def parse_args():
default=1000,
help="cal dev loss every n batches."
"(default: %(default)d)")
parser.add_argument(
'--optim',
default='adam',
help='optimizer type')
parser.add_argument(
'--trainset',
nargs='+',
help='train dataset')
parser.add_argument(
'--devset',
nargs='+',
help='dev dataset')
parser.add_argument(
'--testset',
nargs='+',
help='test dataset')
parser.add_argument(
'--vocab_dir',
help='dict')
parser.add_argument(
'--max_p_num',
type=int,
default=5)
parser.add_argument(
'--max_a_len',
type=int,
default=200)
parser.add_argument(
'--max_p_len',
type=int,
default=500)
parser.add_argument(
'--max_q_len',
type=int,
default=9)
parser.add_argument(
'--doc_num',
type=int,
default=5)
parser.add_argument(
'--para_print',
action='store_true')
parser.add_argument(
'--drop_rate',
type=float, default=0.0)
parser.add_argument(
'--random_seed',
type=int,
default=123)
parser.add_argument('--optim', default='adam', help='optimizer type')
parser.add_argument('--trainset', nargs='+', help='train dataset')
parser.add_argument('--devset', nargs='+', help='dev dataset')
parser.add_argument('--testset', nargs='+', help='test dataset')
parser.add_argument('--vocab_dir', help='dict')
parser.add_argument('--max_p_num', type=int, default=5)
parser.add_argument('--max_a_len', type=int, default=200)
parser.add_argument('--max_p_len', type=int, default=500)
parser.add_argument('--max_q_len', type=int, default=9)
parser.add_argument('--doc_num', type=int, default=5)
parser.add_argument('--para_print', action='store_true')
parser.add_argument('--drop_rate', type=float, default=0.0)
parser.add_argument('--random_seed', type=int, default=123)
parser.add_argument(
'--log_path',
help='path of the log file. If not set, logs are printed to console')
......
......@@ -25,6 +25,7 @@ class Vocab(object):
"""
Implements a vocabulary to store the tokens in the data, with their corresponding embeddings.
"""
def __init__(self, filename=None, initial_tokens=None, lower=False):
self.id2token = {}
self.token2id = {}
......@@ -117,7 +118,9 @@ class Vocab(object):
Args:
min_cnt: tokens with frequency less than min_cnt is filtered
"""
filtered_tokens = [token for token in self.token2id if self.token_cnt[token] >= min_cnt]
filtered_tokens = [
token for token in self.token2id if self.token_cnt[token] >= min_cnt
]
# rebuild the token x id map
self.token2id = {}
self.id2token = {}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册