Add CI pipeline for variant 5
This commit is contained in:
16
ci_lab/text_tools.py
Normal file
16
ci_lab/text_tools.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""Text helper functions."""
|
||||
|
||||
def normalize_text(text: str) -> str:
|
||||
return " ".join(text.lower().split())
|
||||
|
||||
def word_count(text: str) -> int:
|
||||
normalized = normalize_text(text)
|
||||
if not normalized:
|
||||
return 0
|
||||
return len(normalized.split(" "))
|
||||
|
||||
def unique_words(text: str) -> set[str]:
|
||||
normalized = normalize_text(text)
|
||||
if not normalized:
|
||||
return set()
|
||||
return set(normalized.split(" "))
|
||||
Reference in New Issue
Block a user