MCPcopy Create free account
hub / github.com/SooLab/CGFormer / _is_control

Function _is_control

bert/tokenization_utils.py:59–68  ·  view source on GitHub ↗

Checks whether `chars` is a control character.

(char)

Source from the content-addressed store, hash-verified

57
58
59def _is_control(char):
60 """Checks whether `chars` is a control character."""
61 # These are technically control characters but we count them as whitespace
62 # characters.
63 if char == "\t" or char == "\n" or char == "\r":
64 return False
65 cat = unicodedata.category(char)
66 if cat.startswith("C"):
67 return True
68 return False
69
70
71def _is_punctuation(char):

Callers 3

_clean_textMethod · 0.85
_is_end_of_wordFunction · 0.85
_is_start_of_wordFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected