class montreal_forced_aligner.db.PhonologicalRule(**kwargs)[source]#

Bases: Base

Database class for storing information about a phonological rule :param id: Primary key :type id: int :param segment: Segment to replace :type segment: str :param preceding_context: Context before segment to match :type preceding_context: str :param following_context: Context after segment to match :type following_context: str :param replacement: Replacement of segment :type replacement: str :param probability: Probability of the rule application :type probability: float :param silence_after_probability: Probability of silence following forms with rule application :type silence_after_probability: float :param silence_before_correction: Correction factor for silence before forms with rule application :type silence_before_correction: float :param non_silence_before_correction: Correction factor for non-silence before forms with rule application :type non_silence_before_correction: float :param pronunciations: List of rule applications :type pronunciations: list[RuleApplication]


Apply the rule on a pronunciation by replacing any matching segments with the replacement :param pronunciation: Pronunciation to apply rule :type pronunciation: str


Pronunciation with rule applied

Return type:


property match_regex#

Regular expression of the rule


Serializes the rule for export :returns: Serialized rule :rtype: dict[str, Any]