FunASR/funasr/tokenizer/abs_tokenizer.py
zhifu gao 7dadb793e6
Dev gzf funasr2 (#1111)
* update funasr.text -> funasr.tokenizer fix bug export
2023-11-23 16:04:37 +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