mirror of
https://github.com/mii443/tokenizers.git
synced 2025-12-07 13:18:31 +00:00
Python - Update some missing typings
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from .. import Encoding, Offsets
|
||||
from .. import Encoding, Offsets, Token
|
||||
from typing import List, Optional, Union, Tuple
|
||||
|
||||
class Model:
|
||||
@@ -8,6 +8,15 @@ class Model:
|
||||
a Model will return a instance of this class when instantiated.
|
||||
"""
|
||||
|
||||
def tokenize(self, sequence: str) -> List[Token]:
|
||||
""" Tokenize the given sequence """
|
||||
pass
|
||||
def token_to_id(self, token: str) -> Optional[int]:
|
||||
""" Returns the id associated with the given token """
|
||||
pass
|
||||
def id_to_token(self, id: int) -> Optional[str]:
|
||||
""" Returns the token associated with the given id """
|
||||
pass
|
||||
def save(self, folder: str, name: Optional[str] = None) -> List[str]:
|
||||
""" Save the current model
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from .. import Encoding
|
||||
from typing import Tuple, Union, List
|
||||
|
||||
class PostProcessor:
|
||||
@@ -14,6 +15,11 @@ class PostProcessor:
|
||||
:return:
|
||||
"""
|
||||
pass
|
||||
def process(
|
||||
self, encoding: Encoding, pair: Optional[Encoding] = None, add_special_tokens: bool = True
|
||||
) -> Encoding:
|
||||
""" Post-process the given encodings, generating the final one """
|
||||
pass
|
||||
|
||||
class BertProcessing(PostProcessor):
|
||||
""" BertProcessing
|
||||
|
||||
Reference in New Issue
Block a user