summaryrefslogtreecommitdiff
path: root/text_recognizer/data/base_mapping.py
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-10-10 18:04:50 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-10-10 18:04:50 +0200
commit8291a87c64f9a5f18caec82201bea15579b49730 (patch)
tree1c8bb3e07a3bd06086e182dd320f8408829ba81c /text_recognizer/data/base_mapping.py
parent30e3ae483c846418b04ed48f014a4af2cf9a0771 (diff)
Move data utils to submodules
Diffstat (limited to 'text_recognizer/data/base_mapping.py')
-rw-r--r--text_recognizer/data/base_mapping.py37
1 files changed, 0 insertions, 37 deletions
diff --git a/text_recognizer/data/base_mapping.py b/text_recognizer/data/base_mapping.py
deleted file mode 100644
index 572ac95..0000000
--- a/text_recognizer/data/base_mapping.py
+++ /dev/null
@@ -1,37 +0,0 @@
-"""Mapping to and from word pieces."""
-from abc import ABC, abstractmethod
-from typing import Dict, List
-
-from torch import Tensor
-
-
-class AbstractMapping(ABC):
- def __init__(
- self, input_size: List[int], mapping: List[str], inverse_mapping: Dict[str, int]
- ) -> None:
- self.input_size = input_size
- self.mapping = mapping
- self.inverse_mapping = inverse_mapping
-
- def __len__(self) -> int:
- return len(self.mapping)
-
- @property
- def num_classes(self) -> int:
- return self.__len__()
-
- @abstractmethod
- def get_token(self, *args, **kwargs) -> str:
- ...
-
- @abstractmethod
- def get_index(self, *args, **kwargs) -> Tensor:
- ...
-
- @abstractmethod
- def get_text(self, *args, **kwargs) -> str:
- ...
-
- @abstractmethod
- def get_indices(self, *args, **kwargs) -> Tensor:
- ...