Package ca.phon.ipa.features
Class FeatureMatrix
java.lang.Object
ca.phon.ipa.features.FeatureMatrix
Holds all defined feature set for IPA characters. This information is held in
the data/features.xml file.
-
Constructor Summary
ConstructorDescriptionFeatureMatrix
(InputStream stream) FeatureMatrix
(String fmFile) Create a new instance of the FeatureMatrix -
Method Summary
Modifier and TypeMethodDescriptionReturns the character set supported by this feature matrixgetCharactersWithFeature
(String featureName) Returns a collection of all characters that have the given feature.getFeature
(String featureName) Returns the Feature object for the given feature name (or synonym.)Feature[]
getFeatureForIndex
(int idx) Returns the feature name for the given index.getFeaturePrimaryFamily
(String featureName) Returns the name of the primary family for the given feature.Returns a hash set of the names of all the features in the matrix as strings.getFeatureSecondaryFamily
(String featureName) Returns the secondary families for the given feature.getFeatureSet
(char ipaChar) Return the feature set described by the given ipaChar, or null if nonexistent.getFeatureSetForFeature
(String feature) Returns the feature set for the name feature.Returns a hash map with all of the feature sets in the matrix as values.getFeaturesWithPrimaryFamily
(String familyName) static FeatureMatrix
Returns the shared instance of the FeatureMatrixgetNamedFeatureSet
(String name) Return the value of a named FeatureSetReturn all named feature sets.int
Returns the number of features.boolean
putFeaturePrimaryFamily
(String featureName, String familyName) Sets the primary family for the given feature.boolean
putFeatureSecondaryFamily
(String featureName, String familyName) Sets the secondary family for the given feature.void
putFeatureSet
(char ipaChar, FeatureSet newFeatureSet) Set the given feature set for the given IPA character.void
putNamedFeatureSet
(String name, FeatureSet featureSet) Set the value of a named FeatureSetvoid
removeFeatureSet
(char ipaChar) Remove the feature set from the matrix if it exists, do nothing otherwise.void
void
saveAsXML
(OutputStream stream) void
-
Constructor Details
-
FeatureMatrix
Create a new instance of the FeatureMatrix -
FeatureMatrix
-
-
Method Details
-
getInstance
Returns the shared instance of the FeatureMatrix -
saveAsXML
- Throws:
IOException
-
saveAsXML
- Throws:
IOException
-
saveAsXML
- Throws:
IOException
-
getNumberOfFeatures
public int getNumberOfFeatures()Returns the number of features. -
getFeatureSet
Return the feature set described by the given ipaChar, or null if nonexistent.- Parameters:
ipaChar
- IPA character describing the desired feature set- Returns:
- the desired feature set
-
removeFeatureSet
public void removeFeatureSet(char ipaChar) Remove the feature set from the matrix if it exists, do nothing otherwise.- Parameters:
ipaChar
- IPA character representing the feature set to remove
-
putFeatureSet
Set the given feature set for the given IPA character. If that character already has feature set defined, replace that set with the given feature set. Any given feature or feature set that doesn't exist already is created.- Parameters:
ipaChar
- IPA character to put the feature set withnewFeatureSet
- feature set to put in
-
getFeatures
Returns a hash set of the names of all the features in the matrix as strings. If there are no features, returns an empty hash set.- Returns:
- a hash set of the feature names
-
getFeature
Returns the Feature object for the given feature name (or synonym.)- Parameters:
featureName
-- Returns:
- the Feature or null if not found
-
getNamedFeatureSets
Return all named feature sets.- Returns:
- map of named feature sets
-
putNamedFeatureSet
Set the value of a named FeatureSet- Parameters:
name
-featureSet
-
-
getNamedFeatureSet
Return the value of a named FeatureSet- Parameters:
name
-- Returns:
- featureSet for given name or
null
-
getFeatureSets
Returns a hash map with all of the feature sets in the matrix as values. Each feature set has its character as its matching key. If not feature sets exist, returns an empty hash map.- Returns:
- a hash map of characters to feature sets
-
getFeatureSetForFeature
Returns the feature set for the name feature.- Parameters:
feature
- the feature to look up- Returns:
- the featureset for the give feature or an empty set if the feature was not found
-
getCharactersWithFeature
Returns a collection of all characters that have the given feature.- Parameters:
featureName
- the name of the feature to search by- Returns:
- collection of all characters that match featureName
-
getCharacterSet
Returns the character set supported by this feature matrix- Returns:
- set of characters
-
getFeaturePrimaryFamily
Returns the name of the primary family for the given feature. null if the feature does not have a primary family.- Parameters:
featureName
- name of feature- Returns:
- name of feature's primary family
-
getFeatureForIndex
Returns the feature name for the given index. -
putFeaturePrimaryFamily
Sets the primary family for the given feature. If family doesn't exist, it is created. Returns true if successful, false if not. Put will be unsuccessful if feature doesn't exist.- Parameters:
featureName
- name of featurefamilyName
- name of primary family to put with feature- Returns:
- true if successful, false if not
-
getFeatureSecondaryFamily
Returns the secondary families for the given feature. Null if the feature does not have any secondary families.- Parameters:
featureName
- name of the feature- Returns:
- name of the feature's secondary family
-
putFeatureSecondaryFamily
Sets the secondary family for the given feature. If family doesn't exist, it is created. Returns true if successful, false if not. Put will be unsuccessful if feature doesn't exist.- Parameters:
featureName
- name of featurefamilyName
- name of secondary family to put with feature- Returns:
- true if successful, false if not
-
getFeaturesWithPrimaryFamily
-
getFeatureData
-