Skip to content
Snippets Groups Projects
Commit 87663643 authored by Solene Tarride's avatar Solene Tarride
Browse files

Encode text before checking for unknown characters

parent 9e3cde53
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !287. Comments created here will be created in the context of that merge request.
......@@ -226,9 +226,10 @@ class Tokenizer:
:param text: Text to be tokenized.
"""
return " ".join(
self.encode(
[char if char in self.charset else self.unknown_token for char in text]
)
[
char if char in self.charset else self.unknown_token
for char in self.encode(text)
]
)
def encode(self, text: List[str]) -> List[str]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment