NAME

Lingua::Phonology::Functions

SYNOPSIS

use Lingua::Phonology;
use Lingua::Phonology::Functions qw/:all/;

DESCRIPTION

Lingua::Phonology::Functions contains a suite of functions that can be exported to make it easier to write linguistic rules. I hope to have a function here for each broad, sufficiently common linguistic process. So if there are any missing here that you think should be included, feel free to contact the author.

FUNCTIONS

Lingua::Phonology::Functions does not provide an object-oriented interface to its functions. You may either call them with their package name (Lingua::Phonology::Functions::assimilate()), or you may import the functions you wish to use by providing their names as arguments to use. You may import all functions with the argument ':all' (as per the Exporter standard).

Lingua::Phonology::Functions::assimilate();        # If you haven't imported anything
use Lingua::Phonology::Functions qw(assimilate);   # Import just assimilate()
use Lingua::Phonology::Functions qw(:all);          # Import all functions

I have tried to keep the order of arguments consistent between all of the functions. In general, the following hold:

  • If a feature name is needed for a function, that is the first argument.

  • If more than one segment is given as an argument to a function, the first segment will act upon the second segment. That is, some feature from the first segment will be assimilated, copied, dissimilated, etc. to the second segment.

Through these function descriptions, $feature is the name of some feature in the current Lingua::Phonology::Features object, and $segment1, $segment2 . . . $segmentN are Lingua::Phonology::Segment objects depending on that same Features object.

assimilate

assimilate($feature, $segment1, $segment2);

Assimilates $segment2 to $segment1 on $feature. This does a "deep" assimilation, copying the reference from $segment1 to $segment2 so that future modifications of this feature for either segment will be reflected on both segments. If you don't want this, use copy() instead.

adjoin

adjoin($feature, $segment1, $segment2);

This function is synonymous with assimilate(). It is provided only to aid readability.

copy

copy($feature, $segment1, $segment2);

Copies the value of $feature from $segment1 to $segment2. This does a "shallow" copy, copying the value but not the underlying reference.

dissimilate

dissimilate($feature, $segment1, $segment2);

Dissimilates $segment2 from $segment1 on $feature. If $segment1->value($feature) is true, then $segment2->value($feature) is set to false, and vice-versa. The "true" and "false" values tested and returned may differ depending on whether $feature is privative, binary, or scalar.

If $feature is a node, then if $segment1->value($feature) is true, the node $feature for $segment2 will be delinked. This will cause all children of $feature to become undefined. If $segment1->value($feature) is false, no action is taken, because there is no sensible way to assign a true value to a node--nodes only return true if they have defined children, and there is no way to know which child of $feature should be defined. Sorry.

If $segment1 and $segment2 currently have a reference to the same feature, $segment2 will be assigned a new reference, breaking the connection between the two segments.

change

change($segment1, $symbol);

This function changes $segment1 to $symbol, where $symbol is a text string indicating a symbol in the symbol set associated with $segment1. If $segment1 doesn't have a symbol set associated with it, this function will fail.

metathesize

metathesize($segment1, $segment2);

This function swaps the order of $segment1 and $segment2. $segment1 MUST be the first of the two segments, or else this function may result in a non-terminating loop as the same two segments are swapped repeatedly. (The exact behavior of this depends on the implementation of Lingua::Phonology::Rules, which is not a fixed quantity. But things should be okay if you heed this warning.)

The assumption here is that $segment1 and $segment2 are adjacent segments in some word currently being processed by Lingua::Phonology::Rules, since the notion of "segment order" has little meaning outside of this context. Thus, this function assumes that the INSERT_RIGHT() and INSERT_LEFT() methods are available (which is only true during a Lingua::Phonology::Rules evaluation), and will raise errors if this isn't so.

Note that the segments won't actually be switched until after the current do code reference closes, so you can't make changes to the metathesized segments immediately after changing them and have the segments be where you expect them.

metathesize_feature

metathesize_feature($feature, $segment1, $segment2);

This function swaps the value of $feature for $segment1 with the value of $feature for $segment2. This is primarily useful if $feature = 'ROOT', because in this case all of the true feature values will be swapped, but the syllabification will not be changed. Then again, that might not be useful at all.

delete_seg

delete_seg($segment1);

Deletes $segment1. This is essentially a synonym for calling $segment1->clear, though it's more readable.

insert

insert_after($segment1, $segment2);

This function inserts $segment2 after $segment1 in the current word. Like "metathesize", this function assumes that it is being called as part of the do property of a Lingua::Phonology::Rules rule, so any environment other than this will probably raise errors.

insert_before

insert_before($segment1, $segment2);

This function inserts $segment2 before $segment1, just like insert_after(). The same warnings that apply to insert_after() apply to this function.

SEE ALSO

Lingua::Phonology, Lingua::Phonology::Rules, Lingua::Phonology::Features, Lingua::Phonology::Segment

AUTHOR

Jesse S. Bangs <jaspax@u.washington.edu>.

LICENSE

This module is free software. You can distribute and/or modify it under the same terms as Perl itself.