1
Fork 0
mirror of https://github.com/Steffo99/unimore-bda-6.git synced 2024-11-26 09:44:19 +00:00
bda-6-steffo/unimore_bda_6/tokenizer/lower.py

12 lines
315 B
Python
Raw Normal View History

2023-02-04 00:36:42 +00:00
import tensorflow
from .base import BaseTokenizer
class LowercaseTokenizer(BaseTokenizer):
def tokenize_builtins(self, text: str) -> list[str]:
return text.lower().split()
def tokenize_tensorflow(self, text: tensorflow.Tensor) -> tensorflow.Tensor:
return tensorflow.strings.lower(text)