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

Function _is_start_of_word

bert/tokenization_utils.py:92–95  ·  view source on GitHub ↗

Checks whether the first character in text is one of a punctuation, control or whitespace character.

(text)

Source from the content-addressed store, hash-verified

90
91
92def _is_start_of_word(text):
93 """Checks whether the first character in text is one of a punctuation, control or whitespace character."""
94 first_char = text[0]
95 return bool(_is_control(first_char) | _is_punctuation(first_char) | _is_whitespace(first_char))
96
97
98class PreTrainedTokenizer(PreTrainedTokenizerBase):

Callers 1

split_on_tokenMethod · 0.85

Calls 3

_is_controlFunction · 0.85
_is_punctuationFunction · 0.85
_is_whitespaceFunction · 0.85

Tested by

no test coverage detected