summaryrefslogtreecommitdiff
path: root/text_recognizer/data/transforms.py
diff options
context:
space:
mode:
Diffstat (limited to 'text_recognizer/data/transforms.py')
-rw-r--r--text_recognizer/data/transforms.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/text_recognizer/data/transforms.py b/text_recognizer/data/transforms.py
index 616e236..297c953 100644
--- a/text_recognizer/data/transforms.py
+++ b/text_recognizer/data/transforms.py
@@ -23,12 +23,12 @@ class ToLower:
class ToCharcters:
"""Converts integers to characters."""
- def __init__(self) -> None:
- self.mapping, _, _ = emnist_mapping()
+ def __init__(self, extra_symbols: Optional[List[str]] = None) -> None:
+ self.mapping, _, _ = emnist_mapping(extra_symbols)
def __call__(self, y: Tensor) -> str:
"""Converts a Tensor to a str."""
- return "".join([self.mapping(int(i)) for i in y]).strip("<p>").replace(" ", "▁")
+ return "".join([self.mapping[int(i)] for i in y]).replace(" ", "▁")
class WordPieces: