Class FeatureSet

java.lang.Object
ca.phon.ipa.features.FeatureSet
All Implemented Interfaces:
Iterable<Feature>

public class FeatureSet extends Object implements Iterable<Feature>
Class to represent a charater's feature set. Features are stored internally as a BitSet. As of Phon 2.2 objects of this type are immutable after construction.
  • Constructor Details

    • FeatureSet

      public FeatureSet()
      Create a new instance of a feature set
    • FeatureSet

      public FeatureSet(Set<String> features)
    • FeatureSet

      public FeatureSet(BitSet featureSet)
  • Method Details

    • singleonFeature

      public static FeatureSet singleonFeature(String featureName)
      Create a feature set from a single feature.
      Parameters:
      featureName -
    • fromArray

      public static FeatureSet fromArray(String[] features)
      Utility method for creating features sets from an array of values.
      Parameters:
      features - the list of features to add to the set. If the features[x] is a single character, the full feature set of the character is added.
      Returns:
      the created feature set
    • hasFeature

      public boolean hasFeature(String feature)
      Check for existance of a feature
    • getFeatures

      public Collection<String> getFeatures()
      Returnt the features. This is not a live list.
    • size

      public int size()
      Returns the number of features in the set.
      Returns:
      the cardinality of the set
    • sonority

      public int sonority()
    • toString

      public String toString()
      A string representation of the feature set
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • union

      public static FeatureSet union(FeatureSet fs1, FeatureSet fs2)
      Produces a new FeatureSet based on the set-union of the two given FeatureSets
      Parameters:
      fs1 -
      fs2 -
      Returns:
      fs1 UNION fs2
    • intersects

      public boolean intersects(FeatureSet fs2)
    • intersects

      public static boolean intersects(FeatureSet fs1, FeatureSet fs2)
      Do the features sets intersect.
      Parameters:
      fs1 -
      fs2 -
      Returns:
      true if the two given featuresets have any common features.
    • intersect

      public static FeatureSet intersect(FeatureSet fs1, FeatureSet fs2)
      Produces a new FeatureSet based on the set-intersection of the two given FeatureSets.
      Parameters:
      fs1 -
      fs2 -
      Returns:
      fs1 INTERSECT fs2
    • minus

      public static FeatureSet minus(FeatureSet fs1, FeatureSet fs2)
      Produces a new FeatureSet based on the set-subtraction of the given feature sets.
      Parameters:
      fs1 -
      fs2 -
      Returns:
      fs1 MINUS fs2
    • getManner

      public FeatureSet getManner()
      Return the set of manner features for this feature set.
      Returns:
      manner features
    • getPlace

      public FeatureSet getPlace()
    • getVoicing

      public FeatureSet getVoicing()
    • iterator

      public Iterator<Feature> iterator()
      Specified by:
      iterator in interface Iterable<Feature>