Skip to content

Commit

Permalink
Merge pull request google-research#266 from msramalho/patch-1
Browse files Browse the repository at this point in the history
Tokenization code simplification
  • Loading branch information
jacobdevlin-google authored Dec 18, 2018
2 parents c74caa3 + 284945c commit b8ba348
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tokenization.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ def load_vocab(vocab_file):

def convert_by_vocab(vocab, items):
"""Converts a sequence of [tokens|ids] using the vocab."""
output = []
for item in items:
output.append(vocab[item])
return output
return [vocab[item] for item in items]


def convert_tokens_to_ids(vocab, tokens):
Expand Down

0 comments on commit b8ba348

Please sign in to comment.