Skip to content

Commit

Permalink
fix padding error
Browse files Browse the repository at this point in the history
  • Loading branch information
supercoderhawk committed Jul 15, 2020
1 parent 0bca198 commit ac1c338
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions deep_keyphrase/copy_rnn/predict_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ def generate_input(self, tokens):
sent_len = len(token_ids)

if len(token_ids) < self.max_src_len:
token_ids.extend([PAD_WORD] * (self.max_src_len - len(token_ids)))
token_ids_with_oov.extend([PAD_WORD] * (self.max_src_len - len(token_ids)))
pad_tokens = [self.vocab2id[PAD_WORD]] * (self.max_src_len - len(token_ids))
token_ids.extend(pad_tokens)
token_ids_with_oov.extend(pad_tokens)
elif len(token_ids) > self.max_src_len:
token_ids = token_ids[:self.max_src_len]
token_ids_with_oov = token_ids_with_oov[:self.max_src_len]
Expand Down

0 comments on commit ac1c338

Please sign in to comment.