Lingua::Phonology::Segment 0.32 reviewDownload
Lingua::Phonology::Segment is a module to represent a segment as a bundle of feature values. SYNOPSIS use Lingua::Phono
Lingua::Phonology::Segment is a module to represent a segment as a bundle of feature values.
$phono = new Lingua::Phonology;
# Define a feature set
$features = $phono->features;
# Make a segment
$segment = $phono->segment;
# Set some values
# Segment is now voiced labial stop, i.e. [b]
# Reset the segment
A Lingua::Phonology::Segment object provides a programmatic representation of a linguistic segment. Such a segment is associated with a Lingua::Phonology::Features object that lists the available features and the relationships between them. The segment itself is a list of the values for those features.
This module provides methods for returning and setting these feature values. A segment may also be associated with a Lingua::Phonology::Symbols object, which allows the segment to return the symbol that it best matches.
As of Lingua::Phonology v0.32 (Lingua::Phonology::Segment v0.4), string conversion of segments is overloaded. When you use a Lingua::Phonology::Segment in string context, the spell() method is automatically called, and the representation of the segment from the current symbolset is returned. String comparison operators (cmp eq ne lt le gt ge) are also overloaded. Therefore, the following work correctly, assuming that you have a Lingua::Phonology object correctly set up in $phono.
my ($b, $k) = $phono->symbols->segment('b', 'k');
print "Segments: $b, $kn"; # Prints "Segments: b, k";
print "$b is greater than $kn" if $b gt $k; # Won't print
print "$b is less than $kn" if $b lt $k; # Prints 'b is less than k';
print "$b is equal to $kn" if $b eq $k; # Won't print
my $b2 = $b->duplicate;
print "$b is equal to $b2n" if $b eq $b2 # Prints 'b is equal to b';
Note that stringification is not overloaded if the symbolset is not properly set. However, it turns on as soon as a symbolset is available:
my $b = Lingua::Phonology::Segment->new($features);
print "$bn"; # Prints 'Lingua::Phonology::Segment=HASH(0x88af598)'
# or something similar, because there is no symbolset
# defined for spelling the segment.
print "$bn"; # Prints 'b'
Number conversion is not overloaded.
Lingua::Phonology::Segment 0.32 search tags