Lingua-Phonology
view release on metacpan or search on metacpan
Phonology/FileFormatPOD.pm view on Meta::CPAN
clearer. Example:
/z/ => /s/
Read: "All /z/'s become /s/'s."
You can, of course, mix the two styles
[Coronal] => /s/
Read: "All coronals (dentals, alveolars, etc.) become /s/."
Remember that whatever comes between the slashes is the symbol. If you write
C</sk/>, Lingua::Phonology will look for a single segment whose symbol is 'sk'.
If you want an /s/ followed by a /k/, write C</s//k/>.
Another extension of strict linguistic form is the fact that you can include
more than one segment in your input and output segments. Your linguistics
professor might not like the following rule, but Lingua::Phonology has no
problem with it:
Phonology/FileFormatPOD.pm view on Meta::CPAN
(/k/ | [voice] | 0) => [nasal] #WRONG, will not parse
/s/ => /z/ : _0/d/ # WRONG, will not parse
On the left-hand side of an arrow, the C<0> means "Don't look for a segment
here, but insert a segment in this spot." The segment to be inserted is
whatever is in the corresponding spot on the right side of the arrow. Example:
/s/0[Coronal] => []/i/[] : _[*vocoid]
Read: "Insert an /i/ between /s/ and another coronal when the following segment
is not a vocoid". Remember that [] can be used on the left-hand side of a rule
to mean "match anything" and on the right-hand side of an arrow to mean "don't
change anything". This rule is exactly equivalent to the following rule:
0 => /i/ : /s/_[Coronal][*vocoid]
The second form here is more formally correct, but the first illustrates how
you can include a C<0> anywhere in a rule to insert a segment at that point.
On the right-hand side of an arrow, the C<0> means "Delete whichever segment is
Phonology/Symbols.pm view on Meta::CPAN
err "Deprecated method";
while (<$file>) {
s/#.*$//; # Remove comments
if (/^\s*(\S*)\t+(.*)/) { # General line format
my $symbol = $1;
my @desc = split(/\s+/, $2);
my $proto = Lingua::Phonology::Segment->new( $self->features );
for (@desc) {
if (/(\S+)=(\S+)/) { # Feature defs like coronal=1
$proto->value($1, $2);
}
elsif (/([*+-])?(\S+)/) { # Feature defs like +feature or feature
my $val = $1 ? $1 : 1;
$proto->value($2, $val);
}
}
$self->symbol($symbol => $proto);
}
}
t/06syllable.t view on Meta::CPAN
# Allow syllabic nasals (decrease min_nucl_son)
ok $syll->min_nucl_son(1), 'set min_nucl_son';
$syll->syllabify(@word);
is spell_syll(@word), 's<kra><dwi><pnt>s', 'syllabify with min_nucl_son';
# Force all Vs to be nuclei
ok $syll->max_edge_son(2), 'set max_edge_son';
$syll->syllabify(@word);
is spell_syll(@word), 's<kra><du><i><pnt>s', 'syllabify with max_edge_son';
# End-adjoin coronals
ok $syll->end_adjoin(sub { $_[0]->Coronal }), 'set end_adjoin';
$syll->syllabify(@word);
is spell_syll(@word), 's<kra><du><i><pnts>', 'syllabify with end_adjoin';
# Begin-adjoin coronal continuants
ok $syll->begin_adjoin(sub { $_[0]->Coronal && $_[0]->continuant }), 'set begin_adjoin';
$syll->syllabify(@word);
is spell_syll(@word), '<skra><du><i><pnts>', 'syllabify with begin_adjoin';
# Sonorous - make voice count for sonority (just for test purposes)
ok $syll->sonorous->{voice} = 1, 'assign to sonorous()';
is $syll->sonority($word[4]), 1, 'test sonority after sonorous()';
my $fail = 0;
ok ((not $syll->sonorous($fail)), 'test failure of sonority()');
( run in 0.387 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )