API Reference

Phonology module for LatticeLang.

This module provides classes for representing and manipulating phoneme inventories in constructed languages.

class latticelang.phonology.Phoneme(symbol: str, category: ~latticelang.phonology.PhonemeCategory, features: dict[str, ~typing.Any] = <factory>)[source]

Bases: object

Represents a single phoneme with its linguistic features.

A phoneme is the smallest unit of sound that distinguishes meaning in a language. Each phoneme has an IPA symbol and a set of features that describe its articulatory properties.

Example

>>> p = Phoneme(symbol="p", category=PhonemeCategory.CONSONANT,
...             features={
                    "voiced": False,
                    "place": "bilabial",
                    "manner": "plosive"
                })
>>> p.symbol
'p'
>>> p.features["voiced"]
False
category: PhonemeCategory
features: dict[str, Any]
has_feature(feature: str, value: Any = True) bool[source]

Check if this phoneme has a specific feature value.

Parameters:
  • feature – The feature name to check.

  • value – The expected value (defaults to True for boolean features).

Returns:

True if the phoneme has the feature with the specified value.

Example

>>> p = Phoneme("b", PhonemeCategory.CONSONANT, {"voiced": True})
>>> p.has_feature("voiced")
True
>>> p.has_feature("nasal")
False
symbol: str
class latticelang.phonology.PhonemeCategory(*values)[source]

Bases: Enum

Categories of phonemes.

CONSONANT = 'consonant'
DIPHTHONG = 'diphthong'
TONE = 'tone'
VOWEL = 'vowel'