NAME
Lingua::Phonology::Features - a module to handle a set of hierarchical features.
SYNOPSIS
use Lingua::Phonology;
my $phono = new Lingua::Phonology;
my $features = $phono->features;
$features->loadfile; # Load default features
DESCRIPTION
Lingua::Phonology::Features holds a list of hierarchically arranged features of various types, and includes methods for adding and deleting features and changing the relationships between them.
By "heirarchical features" we mean that some features dominate some other features, as in a tree. By having heirarchical features, it becomes possible to set multiple features at once by assigning to a node, and to indicate conceptually related features that are combined under the same node. However, the assignment of values to features is not handled by this module--that's the job of Lingua::Phonology::Segment.
Lingua::Phonology::Features also recognizes multiple types of features. Features may be privative (which means that their legal values are either true or undef), binary (which means they may be true, false, or undef), or scalar (which means that their legal value may be anything). You can freely mix different kinds of features into the same set of features.
Finally, while this module provides a full set of methods to add and delete features programmatically, it also provides the option of reading feature definitions from a file. This is usually faster and more convenient. The method to do this is "loadfile". Lingua::Phonology::Features also comes with an extensive default feature set.
METHODS
new
This method creates and returns a new Features object. It takes no arguments.
add_feature
Adds a new feature to the current list of features. Accepts a list of arguments of the form "feature_name => { ... }", where the value assigned to each feature name must be a hash reference with one or more of the following keys:
type -- The type must be one of 'privative', 'binary', 'scalar', or 'node'. The feature created is of the type specified. This key must be defined for all features.
child -- This is only relevant if the feature type is a node. The value for this key is a reference to an array of feature names. The features named will be assigned as the children of the feature being defined.
parent -- The inverse of
child
. The value for this key must be a reference to an array of feature names that are assigned as the parents of the feature being added.
Note that the features named in parent
or child
must already be defined when the new feature is added. Thus, trying to add parents and children as part of the same call to add_feature() will almost certainly result in errors.
Example:
use Lingua::Phonology::Features;
my $features = new Lingua::Phonology::Features;
$features->add_feature( anterior => { type => 'binary' },
distributed => { type => 'binary' });
$features->add_feature( Coronal => { type => 'node', child => ['anterior', 'distributed']});
feature
Given the name of a feature, returns a hash reference showing the current settings for that feature. The hash reference will at least contain the key 'type', naming the feature type, and may contain the key 'child' if the feature is a node.
drop_feature
Given the name of a feature, deletes the given feature from the current list of features. Note that deleting a node feature does not cause its children to be deleted--it just causes them to revert to being undominated.
change_feature
This method works identically to add_feature(), but it first checks to see that the feature being changed already exists. If it doesn't, it will give an error.
The add_feature() method can also be used to change existing features--this method exists only to aid readability.
all_features
Takes no arguments. Returns a hash with feature names as its keys, and the parameters for those features as its values.
loadfile
Takes one argument, the path and name of a file. Reads the lines of the file and adds all of the features defined therein. You can also call this method with no arguments, in which case the default feature set is loaded.
Feature definition lines should be in this format:
feature_name [1 or more tabs] type [1 or more tabs] children (separated by spaces)
You can order your features any way you want in the file. The method will take care of ensuring that parents are defined before their children are added and make sure no conflicts result.
Lines beginning with a '#' are assumed to be comments are are skipped.
If you don't provide any arguments to this feature, then the default feature set is read and loaded. The default feature set is described in "THE DEFAULT FEATURE SET".
children
Takes one argument, the name of a feature. Returns a list of all of the features that are children of the feature given.
add_child
The first argument to this method should be the name of a node-type feature. The remaining arguments are the names of features to be assigned as children to the first feature.
drop_child
Like add_child, the first argument to this function should be the name of a node feature, and the remaining arguments are the names of children of that node. The child features so named will be deleted from the list of children for that node.
parents
Takes one argument, the name of a feature. Returns a list of the current parent nodes of that feature.
add_parent
Takes two or more arguments. The first argument is the name of a feature, and the remaining arguments are the names of nodes that should be parents of that feature.
drop_parent
Takes two or more arguments. The first is a feature name, and the remaining arguments are the names of features that are currently parents of that feature. Those features will cease to be parents of the first feature.
type
Takes one or two arguments. The first argument must be the name of a feature. If there is only one argument, the type for that feature is return. If there are two arguments, the type is set to the second argument and returned.
number_form
Takes two arguments. The first argument is the name of a feature, and the second is a value to be converted into the appropriate numeric format for that feature. The conversion from input value to numeric value depends on what type of feature the feature given in the first argument is. A few general text conventions are recognized to make text parsing easier and to ensure that number_form and "text_form" can be used as inverses of each other. The conversions are as follows:
The string '*' is recognized as a synonym for
undef
in all circumstances. It always returnsundef
.privative features return 1 if given any true true value, else
undef
.binary features return 1 in the case of a true value, 0 in case of a defined false value, and otherwise
undef
. The string '+' is a synonym for 1, and '-' is a synonym for 0. Thus, the following two lines both return 0:print $features->number_form('binary_feature', 0); # prints 0 print $features->number_form('binary_feature', '-'); # prints 0
However, if the feature given is a privative feature, the first returns
undef
and the second returns 1.scalar features return the value that they're given unchanged (unless that value is '*', which is translated to
undef
).node features do not have values of their own, but should be hash references containing the values for their children. Therefore, nodes return
undef
for anything other than a hash ref, and return hash refs unchanged.
text_form
This function is the inverse of number_form. It takes two arguments, a feature name and a numeric value, and returns a text equivalent for the numeric value given. The exact translation depends on the type of the feature given in the first argument. The translations are:
Any undefined value returns '*'.
privative features return '*' if undef (as above), and '' if defined.
binary features return '+' if true, '-' if false, and '*' if undefined.
scalar features return their values unchanged, except for if they're undefined, in which case they return '*'.
node features behave the same as privative features in this function.
THE DEFAULT FEATURE SET
If you call the method "loadfile"
without any arguments, like this:
$features->loadfile
then the default feature set is loaded. The default feature set is a feature geometry tree based on Clements and Hume (1995), with some modifications. This set gratuitously mixes privative, binary, and scalar features, and may or may not be actually useful to you.
Within this feature set, we use the convention of putting top-level (undominated) nodes in ALL CAPS, putting intermediate nodes in Initial Caps, and putting terminal features in lowercase. The feature tree created is:
# True features
ROOT
|
+-sonorant privative
+-approximant privative
+-vocoid privative
+-nasal privative
+-lateral privative
+-Laryngeal
| |
| +-spread privative
| +-constricted privative
| +-voice privative
|
+-OralCavity
|
+-continuant privative
+-Cplace
|
+-labial privative
+-Lingual
| |
| +-dorsal privative
| +-Coronal
| |
| +-anterior binary
| +-distributed binary
|
+-Vocalic
|
+-aperture scalar
+-tense privative
+-Vplace
|
+-labial (same as above)
+-Lingual (same as above)
# Features dealing with syllable structure
# These are capitalized as if they were in a heirarchy (for
# readability), though properly they don't dominate each other
SYLLABLE privative
onset privative
Rime privative
nucleus privative
coda privative
TO DO
Improve the default feature set. As it is, it cannot handle uvulars or pharyngeals, and has some quirks in its relationships that lead to strange results. Though some of this is the fault of phonologists who can't make up their minds about how things are supposed to go together.
SEE ALSO
Lingua::Phonology::Segment, Lingua::Phonology::Rules
REFERENCES
Clements, G.N and E. Hume. "The Internal Organization of Speech Sounds." Handbook of Phonological Theory. Ed. John A. Goldsmith. Cambridge, Massachusetts: Blackwell, 2001. 245-306.
This article is a terrific introduction to the concept of feature geometry, and also describes ways to write rules in a feature-geometric system.
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.