File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
nemo/collections/common/tokenizers Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -26,29 +26,36 @@ class TokenizerSpec(ABC):
2626
2727 @abstractmethod
2828 def text_to_tokens (self , text ):
29+ """ Converts text into a list of tokens. """
2930 pass
3031
3132 @abstractmethod
3233 def tokens_to_text (self , tokens ):
34+ """ Converts a list of tokens back into text. """
3335 pass
3436
3537 @abstractmethod
3638 def tokens_to_ids (self , tokens ):
39+ """ Converts a list of tokens to their corresponding IDs. """
3740 pass
3841
3942 @abstractmethod
4043 def ids_to_tokens (self , ids ):
44+ """ Converts a list of token IDs back to tokens. """
4145 pass
4246
4347 @abstractmethod
4448 def text_to_ids (self , text ):
49+ """ Converts text directly to token IDs. """
4550 pass
4651
4752 @abstractmethod
4853 def ids_to_text (self , ids ):
54+ """ Converts token IDs back to text. """
4955 pass
5056
5157 def add_special_tokens (self , special_tokens : List [str ]):
58+ """ Adds special tokens (eos, pad, cls...) to vocab. """
5259 raise NotImplementedError ("To be implemented" )
5360
5461 def apply_chat_template (self , * args , ** kwargs ):
You can’t perform that action at this time.
0 commit comments