Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/test_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ def test_control_visualization():


def test_control_tokens_pattern_matches_non_whitespace_controls():
"""CONTROl_TOKENS_PATTERN is public API: words-segmentation builds its regexes from it."""
"""CONTROL_TOKENS_PATTERN is public API: words-segmentation builds its regexes from it."""
import re

from utf8_tokenizer.control import CONTROl_TOKENS_PATTERN
from utf8_tokenizer.control import CONTROL_TOKENS_PATTERN

pattern = re.compile(f"[{CONTROl_TOKENS_PATTERN}]")
pattern = re.compile(f"[{CONTROL_TOKENS_PATTERN}]")
assert [c for c in map(chr, range(128)) if pattern.fullmatch(c)] == \
[*map(chr, range(0x01, 0x09)), *map(chr, range(0x0E, 0x20)), "\x7f"]
2 changes: 1 addition & 1 deletion utf8_tokenizer/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ControlTokens:


# Public: a regex character range of the non-whitespace control tokens (used by words-segmentation)
CONTROl_TOKENS_PATTERN = "\x01-\x08\x0e-\x1f\x7f"
CONTROL_TOKENS_PATTERN = "\x01-\x08\x0e-\x1f\x7f"

CONTROL_WHITESPACES = {
ControlTokens.HorizontalTab,
Expand Down
Loading