variants¶
Phonetic and morphological variant generation for proactive typosquatting detection.
phonemenal.variants
¶
Generate sound-alike spelling variants of a word.
Used for reverse scanning: given a known name, what sound-alike alternatives exist? Generates candidates by applying common phonetic substitutions, double/single letter swaps, and separator permutations.
generate(name: str, *, include_separators: bool = True) -> set[str]
¶
Generate phonetically similar variant spellings of a name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Input name (separators stripped internally). |
required |
include_separators
|
bool
|
If True, also generate hyphen/underscore variants. |
True
|
Returns set of variant strings (excludes the input itself).
Source code in phonemenal/variants.py
generate_morphological(name: str) -> set[str]
¶
Generate morphological variants (suffix/prefix swaps).
These aren't phonetic but are common morphological near-misses: packaging → packages, packaged, packager, etc.