"""Counting words and lines in plain text notes. The module is deliberately untyped at the edges: some of its parameters carry a literal default and no annotation, which is the shape the annotation pattern of this bundle is allowed to touch. """ def count_words(text="", unit="word"): parts = text.split() if unit == "word": return len(parts) if unit == "line": return len(text.splitlines()) return 0 def count_lines(text: str = "") -> int: return len(text.splitlines()) def summarize(text, unit="word"): return count_words(text, unit)