Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A base-class for tokenizers could be useful #29

Open
vinamarora8 opened this issue Nov 15, 2024 · 2 comments
Open

A base-class for tokenizers could be useful #29

vinamarora8 opened this issue Nov 15, 2024 · 2 comments

Comments

@vinamarora8
Copy link
Member

Having a base-class for tokenizers could be useful. It would be like this:

class TokenizerBase:
    def __call__(self, data: Data) -> Dict:
        raise NotImplementedError

All tokenizers will inherit this. It only defines an interface for tokenizers and would help the LSP understand the code better.

@vinamarora8
Copy link
Member Author

If we're at it, we could also define a base-class for transforms

class TransformBase:
    def __call__(self, data: Data) -> Data:
        raise NotImplementedError

@vinamarora8
Copy link
Member Author

We could also just define types like

TokenizerType = Callable[[Data], Dict]
TransformType = Callable[[Data], Data]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant