From 690a5655508cccee298c9482e87bf27cd83281af Mon Sep 17 00:00:00 2001 From: Jonariguez <921829915@qq.com> Date: Sun, 6 Jan 2019 12:30:20 +0800 Subject: [PATCH] make sentence more understandable --- chapter_natural-language-processing/machine-translation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapter_natural-language-processing/machine-translation.md b/chapter_natural-language-processing/machine-translation.md index 556dce8..ee5a76f 100644 --- a/chapter_natural-language-processing/machine-translation.md +++ b/chapter_natural-language-processing/machine-translation.md @@ -20,8 +20,8 @@ PAD, BOS, EOS = '', '', '' 接着定义两个辅助函数对后面读取的数据进行预处理。 ```{.python .input} -# 对一个序列,记录所有的词在 all_tokens 中以便之后构造词典,然后将该序列后添加 PAD 直到 -# 长度变为 max_seq_len,并记录在 all_seqs 中。 +# 对于一个序列,记录其所有的词在 all_tokens 中以便之后构造词典,然后将在该序列后面 +# 添加 PAD 直到长度变为 max_seq_len,并记录在 all_seqs 中。 def process_one_seq(seq_tokens, all_tokens, all_seqs, max_seq_len): all_tokens.extend(seq_tokens) seq_tokens += [EOS] + [PAD] * (max_seq_len - len(seq_tokens) - 1) -- GitLab