Phonology
You could use from sinophone.phonology import * to import all the phonology-related interfaces.
Syllable
You could abbreviate sinophone.phonology.syllable.<something> to sinophone.phonology.<something>.
- class sinophone.phonology.syllable.BranchSyllableComponent(*args, **kwargs)
Bases:
SyllableComponent吳:榦音節要素
- Return type
Any
- property component_order: int
Returns the order of the component in a syllable.
- has_features(features: IPAFeatureGroup) bool
Returns whether a syllable has a feature.
- Parameters
features (IPAFeatureGroup) –
- Return type
bool
- property phonetic_ipa_str: IPAString
Returns the phonetic IPA string of the component. It will be automatically set when the component is rendered in a phonology with phonological rules.
- property recursive_sub_components: List[SyllableComponent]
Recursively returns the sub-components of the syllable component.
- property sub_components: List[SyllableComponent]
Returns the sub-components of the syllable component.
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.syllable.Coda(*args, **kwargs)
Bases:
LeafSyllableComponent吳:韻尾
- Return type
Any
- property component_order: int
Returns the order of the component in a syllable.
- has_features(features: IPAFeatureGroup) bool
Returns whether a syllable has a feature.
- Parameters
features (IPAFeatureGroup) –
- Return type
bool
- property phonetic_ipa_str: IPAString
Returns the phonetic IPA string of the component. It will be automatically set when the component is rendered in a phonology with phonological rules.
- property recursive_sub_components: List[SyllableComponent]
Recursively returns the sub-components of the syllable component.
- property sub_components: List[SyllableComponent]
Returns the sub-components of the syllable component.
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.syllable.Final(*args, **kwargs)
Bases:
BranchSyllableComponent吳:韻母
漢語個韻母,一般可以分析爲 介音+韻腹+韻尾
- Return type
Any
- __init__(medial: ~sinophone.phonology.syllable.Medial = <factory>, nucleus: ~sinophone.phonology.syllable.Nucleus = <factory>, coda: ~sinophone.phonology.syllable.Coda = <factory>) None
- property component_order: int
Returns the order of the component in a syllable.
- has_features(features: IPAFeatureGroup) bool
Returns whether a syllable has a feature.
- Parameters
features (IPAFeatureGroup) –
- Return type
bool
- property phonetic_ipa_str: IPAString
Returns the phonetic IPA string of the component. It will be automatically set when the component is rendered in a phonology with phonological rules.
- property recursive_sub_components: List[SyllableComponent]
Recursively returns the sub-components of the syllable component.
- property sub_components: List[SyllableComponent]
Returns the sub-components of the syllable component.
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.syllable.Initial(*args, **kwargs)
Bases:
LeafSyllableComponent吳:聲母
- Return type
Any
- property component_order: int
Returns the order of the component in a syllable.
- has_features(features: IPAFeatureGroup) bool
Returns whether a syllable has a feature.
- Parameters
features (IPAFeatureGroup) –
- Return type
bool
- property phonetic_ipa_str: IPAString
Returns the phonetic IPA string of the component. It will be automatically set when the component is rendered in a phonology with phonological rules.
- property recursive_sub_components: List[SyllableComponent]
Recursively returns the sub-components of the syllable component.
- property sub_components: List[SyllableComponent]
Returns the sub-components of the syllable component.
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.syllable.LeafSyllableComponent(*args, **kwargs)
Bases:
SyllableComponent吳:梢音節要素
- Return type
Any
- property component_order: int
Returns the order of the component in a syllable.
- has_features(features: IPAFeatureGroup) bool
Returns whether a syllable has a feature.
- Parameters
features (IPAFeatureGroup) –
- Return type
bool
- property phonetic_ipa_str: IPAString
Returns the phonetic IPA string of the component. It will be automatically set when the component is rendered in a phonology with phonological rules.
- property recursive_sub_components: List[SyllableComponent]
Recursively returns the sub-components of the syllable component.
- property sub_components: List[SyllableComponent]
Returns the sub-components of the syllable component.
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.syllable.Medial(*args, **kwargs)
Bases:
LeafSyllableComponent吳:介音
- Return type
Any
- property component_order: int
Returns the order of the component in a syllable.
- has_features(features: IPAFeatureGroup) bool
Returns whether a syllable has a feature.
- Parameters
features (IPAFeatureGroup) –
- Return type
bool
- property phonetic_ipa_str: IPAString
Returns the phonetic IPA string of the component. It will be automatically set when the component is rendered in a phonology with phonological rules.
- property recursive_sub_components: List[SyllableComponent]
Recursively returns the sub-components of the syllable component.
- property sub_components: List[SyllableComponent]
Returns the sub-components of the syllable component.
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.syllable.Nucleus(*args, **kwargs)
Bases:
LeafSyllableComponent吳:韻腹
- Return type
Any
- property component_order: int
Returns the order of the component in a syllable.
- has_features(features: IPAFeatureGroup) bool
Returns whether a syllable has a feature.
- Parameters
features (IPAFeatureGroup) –
- Return type
bool
- property phonetic_ipa_str: IPAString
Returns the phonetic IPA string of the component. It will be automatically set when the component is rendered in a phonology with phonological rules.
- property recursive_sub_components: List[SyllableComponent]
Recursively returns the sub-components of the syllable component.
- property sub_components: List[SyllableComponent]
Returns the sub-components of the syllable component.
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.syllable.RootSyllableComponent(*args, **kwargs)
Bases:
BranchSyllableComponent吳:根音節要素
- Return type
Any
- property component_order: int
Returns the order of the component in a syllable.
- has_features(features: IPAFeatureGroup) bool
Returns whether a syllable has a feature.
- Parameters
features (IPAFeatureGroup) –
- Return type
bool
- property phonetic_ipa_str: IPAString
Returns the phonetic IPA string of the component. It will be automatically set when the component is rendered in a phonology with phonological rules.
- property recursive_sub_components: List[SyllableComponent]
Recursively returns the sub-components of the syllable component.
- property sub_components: List[SyllableComponent]
Returns the sub-components of the syllable component.
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- sinophone.phonology.syllable.SYLLABLE_STRUCTURE: Dict[str, List[str]] = {'Coda': [], 'Final': ['Medial', 'Nucleus', 'Coda'], 'Initial': [], 'Medial': [], 'Nucleus': [], 'Syllable': ['Initial', 'Final', 'Tone'], 'Tone': []}
Hard-code syllable structure of Chinese.
- class sinophone.phonology.syllable.Syllable(*args, **kwargs)
Bases:
RootSyllableComponent吳:音節
漢語個音節,一般可以分析爲 聲母+韻母+聲調
- Return type
Any
- __init__(initial: ~sinophone.phonology.syllable.Initial = <factory>, final: ~sinophone.phonology.syllable.Final = <factory>, tone: ~sinophone.phonology.syllable.Tone = <factory>) None
- property component_order: int
Returns the order of the component in a syllable.
- has_features(features: IPAFeatureGroup) bool
Returns whether a syllable has a feature.
- Parameters
features (IPAFeatureGroup) –
- Return type
bool
- property phonetic_ipa_str: IPAString
Returns the phonetic IPA string of the component. It will be automatically set when the component is rendered in a phonology with phonological rules.
- property recursive_sub_components: List[SyllableComponent]
Recursively returns the sub-components of the syllable component.
- property sub_components: List[SyllableComponent]
Returns the sub-components of the syllable component.
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.syllable.SyllableComponent(*args, **kwargs)
Bases:
PrettyClassThe base class for a syllable component.
- 吳:音節要素
梢音節要素
- 榦音節要素
根音節要素
- Return type
Any
- property component_order: int
Returns the order of the component in a syllable.
- has_features(features: IPAFeatureGroup) bool
Returns whether a syllable has a feature.
- Parameters
features (IPAFeatureGroup) –
- Return type
bool
- property phonetic_ipa_str: IPAString
Returns the phonetic IPA string of the component. It will be automatically set when the component is rendered in a phonology with phonological rules.
- property recursive_sub_components: List[SyllableComponent]
Recursively returns the sub-components of the syllable component.
- property sub_components: List[SyllableComponent]
Returns the sub-components of the syllable component.
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.syllable.Tone(*args, **kwargs)
Bases:
LeafSyllableComponent吳:聲調
- Return type
Any
- property component_order: int
Returns the order of the component in a syllable.
- has_features(features: IPAFeatureGroup) bool
Returns whether a syllable has a feature.
- Parameters
features (IPAFeatureGroup) –
- Return type
bool
- property phonetic_ipa_str: IPAString
Returns the phonetic IPA string of the component. It will be automatically set when the component is rendered in a phonology with phonological rules.
- property recursive_sub_components: List[SyllableComponent]
Recursively returns the sub-components of the syllable component.
- property sub_components: List[SyllableComponent]
Returns the sub-components of the syllable component.
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
Phonology
You could abbreviate sinophone.phonology.phonology.<something> to sinophone.phonology.<something>.
- class sinophone.phonology.phonology.PhonologicalRule(phoneme: ~sinophone.phonology.syllable.SyllableComponent = <factory>, phonetic_ipa_str: ~sinophone.phonetics.ipa_utils.IPAString = <factory>, syllable_pattern: ~typing.Callable[[~sinophone.phonology.syllable.Syllable], bool] = <factory>)
Bases:
PrettyClass吳:音韻規則
- Parameters
phoneme (SyllableComponent) –
phonetic_ipa_str (IPAString) –
syllable_pattern (Callable[[Syllable], bool]) –
- apply(syllable: S) SyllableInPhonology
Returns a the syllable after applying the phonological rule on it.
- Parameters
syllable (S) –
- Return type
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.phonology.Phonology(initials: ~typing.MutableSet[~sinophone.phonology.syllable.Initial] = <factory>, finals: ~typing.MutableSet[~sinophone.phonology.syllable.Final] = <factory>, tones: ~typing.MutableSet[~sinophone.phonology.syllable.Tone] = <factory>, syllables: ~typing.MutableSet[~sinophone.phonology.syllable.Syllable] = <factory>, phonotactics: ~typing.MutableSet[~sinophone.phonology.phonology.PhonotacticConstraint] = <factory>, phonological_rules: ~typing.Sequence[~sinophone.phonology.phonology.PhonologicalRule] = <factory>, color_syllables: bool = True, phonetic_str: bool = True)
Bases:
PrettyClass吳:音韻體系 (音系)
- Parameters
initials (MutableSet[Initial]) –
finals (MutableSet[Final]) –
tones (MutableSet[Tone]) –
syllables (MutableSet[Syllable]) –
phonotactics (MutableSet[PhonotacticConstraint]) –
phonological_rules (Sequence[PhonologicalRule]) –
color_syllables (bool) –
phonetic_str (bool) –
- property collocations: AbstractSet[SyllableInPhonology]
Collocates all phonemes and returns resulting syllables.
- color_syllables: bool = True
Whether to color syllables based on phonotactic acceptability, different from
sinophone.options.color, which controls coloring of syllable components.
- property leaf_phoneme_collection: AbstractSet[LeafSyllableComponent]
Returns the set of leaf phonemes in the phonology.
- property phoneme_collection: AbstractSet[SyllableComponent]
Returns the phoneme collection of the phonology.
- phonetic_str: bool = True
Whether to return the phonetic IPA string of a syllable.
- pretty_print_syllable(syllable: S) None
Prints
pretty_syllable_str.- Parameters
syllable (S) –
- Return type
None
- pretty_syllable_str(syllable: S) str
Returns a pretty string representation of a syllable in the phonology based on options.
- Parameters
syllable (S) –
- Return type
str
- property recursive_phoneme_collection: AbstractSet[SyllableComponent]
Recursively returns the phoneme collection of the phonology.
- refresh() None
Refreshes the phonology, re-generating all syllables.
- Return type
None
- render_syllable(syllable: Syllable) SyllableInPhonology
Renders a syllable in the phonology by applying phonotactics and phonological rules.
- Parameters
syllable (Syllable) –
- Return type
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- update_phoneme_collections_from_syllables() None
Updates the phoneme collections from the syllables.
- Return type
None
- update_rendered_syllables() None
Updates the rendered syllables of the phonology.
- Return type
None
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.phonology.PhonotacticAcceptability(existent: bool = False, grammatical: bool = False)
Bases:
PrettyClass吳:音位排列受容性
- Parameters
existent (bool) –
grammatical (bool) –
- existent: bool = False
吳:是否存在
- grammatical: bool = False
吳:是否合法
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.phonology.PhonotacticConstraint(syllable_pattern: ~typing.Callable[[~sinophone.phonology.syllable.Syllable], bool] = <factory>, acceptability: ~sinophone.phonology.phonology.PhonotacticAcceptability = <factory>)
Bases:
PrettyClass吳:音位排列制約
音位排列,普譯曰「語音組合法」,日譯曰「音素配列論」。
在墶認爲音節總個結構只好是 聲母+韻母+聲調 個情況下頭,畀出其他個音位排列規則。
- Parameters
syllable_pattern (Callable[[Syllable], bool]) –
acceptability (PhonotacticAcceptability) –
- apply(syllable: S) SyllableInPhonology
Returns a the syllable after applying the phonotactic constraint on it.
- Parameters
syllable (S) –
- Return type
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.phonology.SyllableFeatures(syllable_component_features: ~typing.Dict[~typing.Literal['Syllable', 'Initial', 'Final', 'Medial', 'Nucleus', 'Coda', 'Tone'], ~typing.AbstractSet[~sinophone.phonetics.phonetics.IPAFeatureGroup]] = <factory>)
Bases:
PrettyClass吳:音節特徵
A friendly way of generating a
SyllablePatterncallable.syllable_component_featuresis a dictionary of component names to sets of features. When called, it returnsTrueif all syllable components matches any of the features in the set that is its key.幫助生成一個
(匹配) 音節模式可調對象。- Parameters
syllable_component_features (Dict[Literal['Syllable', 'Initial', 'Final', 'Medial', 'Nucleus', 'Coda', 'Tone'], ~typing.AbstractSet[~sinophone.phonetics.phonetics.IPAFeatureGroup]]) –
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.
- class sinophone.phonology.phonology.SyllableInPhonology(*args, **kwargs)
Bases:
Syllable吳:音節在音系中個實現
- Return type
Any
- property color: str
Returns the color code for this syllable.
Check
sinophone.options.color_schemefor the meanings of each color.
- property component_order: int
Returns the order of the component in a syllable.
- classmethod from_syllable(syllable: S) SyllableInPhonology
Casts a
Syllableto aSyllableInPhonology.- Parameters
syllable (S) –
- Return type
- has_features(features: IPAFeatureGroup) bool
Returns whether a syllable has a feature.
- Parameters
features (IPAFeatureGroup) –
- Return type
bool
- property phonetic_ipa_str: IPAString
Returns the phonetic IPA string of the component. It will be automatically set when the component is rendered in a phonology with phonological rules.
- property recursive_sub_components: List[SyllableComponent]
Recursively returns the sub-components of the syllable component.
- property sub_components: List[SyllableComponent]
Returns the sub-components of the syllable component.
- property translated_name: str
The name of the component in a language according to the language code as specified in
sinophone.options.repr_lang.
- property wuu_hant_name: str
Wu Chinese translation of a
SyllableComponentin Sinographs is always preceded by吳:in the docstring.