|
TTY OV
1
A cross platform python terminal
|

Public Member Functions | |
| "Normalise" | __new__ (cls) |
Static Public Member Functions | |
| Set[str] | normalize (Iterable[str] words) |
| Set[str] | load_from_file (str filepath, str encoding="utf-8") |
| Dict[object, Set[str]] | load_mapping ("dict" mapping) |
Static Public Attributes | |
| Disp | disp = initialise_logger(__qualname__, False) |
Static Protected Attributes | |
| Lock | _instance_lock = Lock() |
| Optional | _instance = None |
Normalization utilities for word-list processing. Provides singleton static methods for cleaning and normalizing word lists. Methods are intentionally simple and easy to test. They do not mutate external state, and all operations are thread-safe with explicit locking for logging consistency.
Definition at line 40 of file normalise.py.
| "Normalise" polyguard.src.normalise.Normalise.__new__ | ( | cls | ) |
Definition at line 52 of file normalise.py.
|
static |
Load and normalize words from a newline-delimited text file.
Reads the file line-by-line and passes each line to normalize().
Missing or unreadable files return an empty set without raising.
Args:
filepath: Path to text file containing newline-delimited words.
encoding: Character encoding for file read. Defaults to utf-8.
Returns:
Set[str]: Normalized set of words from the file, or empty set if file not found.
Definition at line 90 of file normalise.py.
|
static |
Normalize a mapping of keys to word iterables into key to word sets.
Transforms each value in the mapping through normalize(). The function
does not assume any particular key type; callers should validate keys
where necessary. None values are transformed to empty sets.
Args:
mapping: Dictionary with arbitrary keys and word iterables as values.
Returns:
Dict[object, Set[str]]: Mapping with same keys but normalized word sets as values.
Definition at line 115 of file normalise.py.
|
static |
Clean and normalize an iterable of words to a lowercase set.
Filters out None values, empty strings, and whitespace-only entries.
All output words are converted to lowercase and stripped of whitespace.
Uses class-level logging lock to ensure interleaved output consistency.
Args:
words: Iterable of string words to normalize.
Returns:
Set[str]: Set of normalized (lowercase, stripped) words.
Definition at line 59 of file normalise.py.
|
staticprotected |
Definition at line 49 of file normalise.py.
|
staticprotected |
Definition at line 48 of file normalise.py.
|
static |
Definition at line 50 of file normalise.py.