1
Fork 0
mirror of https://github.com/Steffo99/unimore-bda-6.git synced 2024-11-24 16:54:20 +00:00
bda-6-steffo/unimore_bda_6/tokenizer/plain.py
2023-02-12 05:11:58 +01:00

13 lines
319 B
Python

import typing as t
from .base import BaseTokenizer
class PlainTokenizer(BaseTokenizer):
"""
Tokenizer which just splits the text into tokens by separating them at whitespaces with `str.split`.
"""
def tokenize(self, text: str) -> t.Iterator[str]:
tokens = text.split()
return tokens