Skip to content
Closed
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
3 changes: 2 additions & 1 deletion complex_tokenization/graphs/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def utf8(s: str) -> GraphVertex:


def utf8_clusters(s: str) -> GraphVertex:
clusters = regex.findall(r'\X', s)
# ASCII has no multi-codepoint grapheme clusters, so skip the \X regex.
clusters = list(s) if s.isascii() else regex.findall(r'\X', s)
nodes = []
for cluster in clusters:
handler = _get_handler(cluster)
Expand Down
Loading