Files
lab4/ci_lab/text_tools.py
lilrax 4544efe463
Some checks failed
CI / Lint / Ruff (push) Has been cancelled
CI / Test / Pytest coverage (push) Has been cancelled
CI / Build / Poetry package (push) Has been cancelled
Add CI pipeline for variant 5
2026-05-18 00:07:59 +03:00

17 lines
423 B
Python

"""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(" "))