Skip to content

alkove.Lex

class Lex(models: Models)

Text to phonemes in fr, en, es, pt, it, ca, ro: Lex’s beam search, word by word.

phonemize(text: Union[str, Sequence[str]], lang: str) -> list

The likeliest pronunciations first, [{ipa, p}]; a list of them for a list of texts.

compile(
text: str,
lang: Union[str, Sequence[str]],
*,
chain: Optional[str] = None,
) -> Word

compile with this Lex: a typed word in one or more of its languages.

Lex.distance(a: str, b: str) -> float

0 = the same sound; a substitution between interchangeable phonemes costs half.

Attribute Type Description
langs tuple The languages Lex reads.
inventory tuple Spot’s 58 phonemes in IPA: the symbols a word between slashes may use (stress and length marks are ignored).