Package com.gengoai.hermes.morphology
Class UniversalFeatureSet
- java.lang.Object
-
- com.gengoai.hermes.morphology.UniversalFeatureSet
-
- All Implemented Interfaces:
Copyable<UniversalFeatureSet>
,Iterable<Tuple2<UniversalFeature,UniversalFeatureValue>>
public class UniversalFeatureSet extends Object implements Iterable<Tuple2<UniversalFeature,UniversalFeatureValue>>, Copyable<UniversalFeatureSet>
A set ofUniversalFeature
and their associatedUniversalFeatureValue
-
-
Constructor Summary
Constructors Constructor Description UniversalFeatureSet()
Instantiates a new empty UniversalFeatureSet.UniversalFeatureSet(@NonNull Tuple2<UniversalFeature,UniversalFeatureValue>... entries)
Instantiates a new UniversalFeatureSet from a number of features and values.UniversalFeatureSet(@NonNull Collection<UniversalFeatureSet> collection)
Instantiates a new UniversalFeatureSet by taking the union of existing sets.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(@NonNull UniversalFeature feature, @NonNull UniversalFeatureValue value)
Checks if the given feature and value combination are in the set.boolean
containsFeature(@NonNull UniversalFeature feature)
Checks if the given feature is in the setUniversalFeatureSet
copy()
UniversalFeatureValue
get(@NonNull UniversalFeature feature)
Gets the first value of the given feature in the set.Set<UniversalFeatureValue>
getAll(@NonNull UniversalFeature feature)
Gets all values associated with the given feature.Iterator<Tuple2<UniversalFeature,UniversalFeatureValue>>
iterator()
static UniversalFeatureSet
parse(@NonNull String string)
Parses the given string to construct aUniversalFeatureSet
String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
UniversalFeatureSet
public UniversalFeatureSet()
Instantiates a new empty UniversalFeatureSet.
-
UniversalFeatureSet
public UniversalFeatureSet(@NonNull @NonNull Collection<UniversalFeatureSet> collection)
Instantiates a new UniversalFeatureSet by taking the union of existing sets.- Parameters:
collection
- the collection of UniversalFeatureSet to union together to create this set
-
UniversalFeatureSet
@SafeVarargs public UniversalFeatureSet(@NonNull @NonNull Tuple2<UniversalFeature,UniversalFeatureValue>... entries)
Instantiates a new UniversalFeatureSet from a number of features and values.- Parameters:
entries
- the tuple entries defining features and associated values
-
-
Method Detail
-
parse
public static UniversalFeatureSet parse(@NonNull @NonNull String string)
Parses the given string to construct aUniversalFeatureSet
- Parameters:
string
- the string- Returns:
- the UniversalFeatureSet
-
contains
public boolean contains(@NonNull @NonNull UniversalFeature feature, @NonNull @NonNull UniversalFeatureValue value)
Checks if the given feature and value combination are in the set.- Parameters:
feature
- the featurevalue
- the value- Returns:
- True in the set, False otherwise
-
containsFeature
public boolean containsFeature(@NonNull @NonNull UniversalFeature feature)
Checks if the given feature is in the set- Parameters:
feature
- the feature- Returns:
- True in the set, False otherwise
-
copy
public UniversalFeatureSet copy()
- Specified by:
copy
in interfaceCopyable<UniversalFeatureSet>
-
get
public UniversalFeatureValue get(@NonNull @NonNull UniversalFeature feature)
Gets the first value of the given feature in the set.- Parameters:
feature
- the feature- Returns:
- the value of the given feature or null
-
getAll
public Set<UniversalFeatureValue> getAll(@NonNull @NonNull UniversalFeature feature)
Gets all values associated with the given feature.- Parameters:
feature
- the feature- Returns:
- all values for the given feature
-
iterator
public Iterator<Tuple2<UniversalFeature,UniversalFeatureValue>> iterator()
- Specified by:
iterator
in interfaceIterable<Tuple2<UniversalFeature,UniversalFeatureValue>>
-
-