FunASR/funasr/text/abs_tokenizer.py
2022-11-26 21:56:51 +08:00

15 lines
347 B
Python

from abc import ABC
from abc import abstractmethod
from typing import Iterable
from typing import List
class AbsTokenizer(ABC):
@abstractmethod
def text2tokens(self, line: str) -> List[str]:
raise NotImplementedError
@abstractmethod
def tokens2text(self, tokens: Iterable[str]) -> str:
raise NotImplementedError