Lingua::FeatureMatrix::Eme - Abstract base class contains one single eme's features.
TO DO:
use Lingua::FeatureMatrix::Eme; blah blah blah
This class is a container for a list of features. A Lingua::FeatureMatrix object stores a table of these.
Lingua::FeatureMatrix
Use this class to build your own subtypes for use with Lingua::FeatureMatrix. Lingua::FeatureMatrix::Eme provides the necessary base class methods to interact with Lingua::FeatureMatrix.
Lingua::FeatureMatrix::Eme
The following methods are public (and used by Lingua::FeatureMatrix):
The new() method will construct and return an object blessed into the current class. In addition, this method will initialize each element of the feature list (returned from the getFeatureList() method) with the string "unset".
getFeatureList()
Arguments passed to new() will be treated as a hash of name => value pairs. All keys (see exception below) will be treated as method names, and the method will be invoked with the corresponding value (this will ordinarily set the feature named key to value).
new()
NOTE: users will probably rarely invoke this method directly, since the Lingua::FeatureMatrix code builds these objects as needed while configuring itself.
Note also that the key options will be explicitly ignored if present so that subclasses can hang any special initialization values off that argument. This allows users to pass their special arguments to their subclasses via the eme_opts named parameter to Lingua::FeatureMatrix-new()>.
options
eme_opts
Lingua::FeatureMatrix-
Lists how this class fails its own contract. By extension, indicates how a subclass fails the contract. Handy for sanity checking.
returns whether the feature passed by argument is specified. Will croak if the feature specified is not supported by the class.
croak
Returns which features have never been specified. Note this is *not* the same as those features that are undef, since that undef is a value that can legitimately be specified. See "Implicatures" in Lingua::FeatureMatrix for more details.
undef
Returns whether the Eme object in question has had all its features fully specified.
Eme
Returns whether the Eme object is equivalent to a (different) Eme object of the same class handed in.
Rejects Eme objects of different classes, and issues warnings if any fields needed to make the decision are as yet unset (though undef fields are acceptable).
unset
Returns that list of features that were specified by the user (not by implication).
feature
Returns that list of features that were computed by the implications specified while configuring the Lingua::FeatureMatrix parent object.
Returns feature's value. Note that ungrammatical features will return a false value.
Dumps textual representation of self's featureset, including the [] brackets. Note any features that were not set by user or by implication will be dumped as ?.
[]
?
Dumps the features passed by argument, and their value, as a text string.
Given a featurename, returns a list of the text form of the implications that were used to set that feature. If the feature does not exist, returns undefined.
Those who want to build their own subclass should build one to the following specification. Note that the Phone and Letter subclasses provided in the examples/ distribution of Lingua::FeatureMatrix are good places to start.
Phone
Letter
examples/
Any subclass should support a class method getFeatureNames which should return, in some interesting (and ideally reliable) order, the list of features that are supported by the subclass.
getFeatureNames
Each feature listed by getFeatureNames should:
be an instance method of the class.
return the value of that feature when called with no argument (easily written with Class::MethodMaker).
Class::MethodMaker
set the value of that feature when called with an argument (easily written with Class::MethodMaker).
when called with an argument, must accept the following values:
Ignoring or rejecting other values is acceptable.
new() should respond as follows:
Either don't provide a new() (let superclass take care of it) or:
Get your options from the options key/value pair from the argument list, then:
call SUPER::init to be sure that the Eme object handles itself properly.
In general, try to follow OO subclassing best practices, or use the provided examples/Phone.pm and examples/Letter.pm as guides.
examples/Phone.pm
examples/Letter.pm
It is strongly recommended to use Class::MethodMaker to build the feature subroutines; in fact, that is all the author has tested with.
Original version; created by h2xs 1.21 with options
-CAX Lingua::FeatureMatrix::Eme
failsContract()
isEquivalent()
Jeremy Kahn, <kahn@cpan.org>
perl.
Lingua::FeatureMatrix.
1 POD Error
The following errors were encountered while parsing the POD:
Expected text after =item, not a number
To install Lingua::FeatureMatrix, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::FeatureMatrix
CPAN shell
perl -MCPAN -e shell install Lingua::FeatureMatrix
For more information on module installation, please visit the detailed CPAN module installation guide.