utils.py 244 B

1234567
  1. from typing import Tuple
  2. PAT = r"""'(?:[sdmt]|ll|ve|re)| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+"""
  3. def to_bytes_tuple(word: str) -> Tuple[bytes]:
  4. l = list(word.encode("utf-8"))
  5. l = [bytes([x]) for x in l]
  6. return tuple(l)