Checks whether `chars` is a punctuation character.
(char)
| 69 | |
| 70 | |
| 71 | def _is_punctuation(char): |
| 72 | """Checks whether `chars` is a punctuation character.""" |
| 73 | cp = ord(char) |
| 74 | # We treat all non-letter/number ASCII as punctuation. |
| 75 | # Characters such as "^", "$", and "`" are not in the Unicode |
| 76 | # Punctuation class but we treat them as punctuation anyways, for |
| 77 | # consistency. |
| 78 | if (cp >= 33 and cp <= 47) or (cp >= 58 and cp <= 64) or (cp >= 91 and cp <= 96) or (cp >= 123 and cp <= 126): |
| 79 | return True |
| 80 | cat = unicodedata.category(char) |
| 81 | if cat.startswith("P"): |
| 82 | return True |
| 83 | return False |
| 84 | |
| 85 | |
| 86 | def _is_end_of_word(text): |
no outgoing calls
no test coverage detected