Lingua::Phonology::Rules is a Perl module for defining and applying phonological rules.
$phono = new Lingua::Phonology;
$rules = $phono->rules;
# Adding and manipulating rules is discussed in the "WRITING RULES"
This module allows for the creation of linguistic rules, and the application of those rules to "words" of Segment objects. You, the user, add rules to a Rules object, defining various parameters and code references that actually perform the action of the rule. Lingua::Phonology::Rules will take care of the guts of applying and creating rules.
The rules you create may have the following parameters. This is just a brief description of the parameters--a more detailed discussion of their effect is in the "WRITING RULES" section.
Defines the domain within which the rule applies. This should be the name of a feature in the featureset of the segments which the rule is applied to.
Defines the tier on which the rule applies. Must be the name of a feature in the feature set for the segments of the word you pass in.
Defines the direction that the rule applies in. Must be either 'leftward' or 'rightward.' If no direction is given, defaults to 'rightward'.
Defines a filter for the segments that the rule applies on. Must a code reference that returns a truth value.
Defines a linguistic-style rule to be parsed. When you provide a linguistic-style rule, it is parsed into code references that take the place of the where and do properties listed below. The format of linguistic rules is described in "LINGUISTIC-STYLE RULES" in Lingua::Phonology::FileFormatPOD.
where - defines the condition or conditions where the rule applies. Must be a coderef that returns a truth value. If no value is given, defaults to always true.
do - defines the action to take when the where condition is met. Must be a code reference. If no value is given, does nothing.
result - EXPERIMENTAL. Defines a condition that must be true after the do code has applied. Must be a code reference that returns a truth value. NOTE: This parameter depends on the module Whatif (available from CPAN), and will behave differently if this module is not present. See "Using result".
Lingua::Phonology::Rules is flexible and powerful enough to handle any sequential type of rule system. It cannot handle Optimality Theory-style processes, because those require a fundamentally different kind of algorithm.