abs_tokenizer.py 347 B

1234567891011121314
  1. from abc import ABC
  2. from abc import abstractmethod
  3. from typing import Iterable
  4. from typing import List
  5. class AbsTokenizer(ABC):
  6. @abstractmethod
  7. def text2tokens(self, line: str) -> List[str]:
  8. raise NotImplementedError
  9. @abstractmethod
  10. def tokens2text(self, tokens: Iterable[str]) -> str:
  11. raise NotImplementedError