提交 5ba2f999 编写于 作者: W wangmeng28

Change the split level of poem sentences

上级 7740e7ce
此差异已折叠。
...@@ -82,7 +82,7 @@ def generate(model_path, word_dict_path, test_data_path, batch_size, beam_size, ...@@ -82,7 +82,7 @@ def generate(model_path, word_dict_path, test_data_path, batch_size, beam_size,
decoder_hidden_dim=512, decoder_hidden_dim=512,
bos_id=0, bos_id=0,
eos_id=1, eos_id=1,
max_length=17, max_length=9,
beam_size=beam_size, beam_size=beam_size,
is_generating=True) is_generating=True)
......
...@@ -52,7 +52,7 @@ def preprocess(datadir, outfile, dictfile): ...@@ -52,7 +52,7 @@ def preprocess(datadir, outfile, dictfile):
u"!" in p or u"?" in p or u"●" in p or u"□" in p or u"!" in p or u"?" in p or u"●" in p or u"□" in p or
u"囗" in p or u")" in p): u"囗" in p or u")" in p):
continue continue
paragraphs = p.split(u"。") paragraphs = re.split(u"。|,", p)
paragraphs = filter(lambda x: len(x), paragraphs) paragraphs = filter(lambda x: len(x), paragraphs)
if len(paragraphs) > 1: if len(paragraphs) > 1:
dataset.append((title, author, paragraphs)) dataset.append((title, author, paragraphs))
......
...@@ -90,7 +90,7 @@ def train(num_passes, ...@@ -90,7 +90,7 @@ def train(num_passes,
decoder_hidden_dim=512, decoder_hidden_dim=512,
bos_id=0, bos_id=0,
eos_id=1, eos_id=1,
max_length=17) max_length=9)
parameters = paddle.parameters.create(cost) parameters = paddle.parameters.create(cost)
if init_model_path: if init_model_path:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册