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

Function _is_end_of_word

bert/tokenization_utils.py:86–89  ·  view source on GitHub ↗

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

(text)

Source from the content-addressed store, hash-verified

84
85
86def _is_end_of_word(text):
87 """Checks whether the last character in text is one of a punctuation, control or whitespace character."""
88 last_char = text[-1]
89 return bool(_is_control(last_char) | _is_punctuation(last_char) | _is_whitespace(last_char))
90
91
92def _is_start_of_word(text):

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