public class FeatureSet extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Vector |
features |
protected Vector |
values |
| Constructor and Description |
|---|
FeatureSet()
Creates an empty FeatureSet.
|
FeatureSet(FeatureSet fs)
creates a new FeatureSet with the same features and values as
fs. |
FeatureSet(StreamTokenizer tok,
boolean allowVariables,
char endChar)
This constructor reads a feature set from StreamTokenizer tok.
|
FeatureSet(String feat1,
Object val1)
Creates a FeatureSet with one feature/value pair.
|
FeatureSet(String feat1,
Object val1,
String feat2,
Object val2)
Creates a FeatureSet with two feature/value pairs.
|
FeatureSet(String feat1,
Object val1,
String feat2,
Object val2,
String feat3,
Object val3)
Creates a FeatureSet with three feature/value pairs.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsFeature(String feat)
Returns true if the FeatureSet has feature feat with some value,
possibly
null. |
boolean |
equals(FeatureSet fs)
Returns true if the FeatureSet is equal to fs: whether the two
FeatureSets have the same features with equal values.
|
boolean |
equals(Object obj)
Returns true if the FeatureSet is equal to fs: whether the two
FeatureSets have the same features with equal values.
|
Object |
get(String feat)
Returns the value associated with feature feat.
|
Enumeration |
keys()
Returns an Enumeration over the features in the feature set.
|
void |
prepareToMakeString(int nestingLimit)
add an 'id' feature to all Annotations referenced by this FeatureSet.
|
void |
put(String feat,
Object val)
Associates the specified value val with the feature feat.
|
void |
putAll(FeatureSet fs)
putAll adds all the feature/value pairs in FeatureSet fs
|
void |
remove(String feat)
Removes the value associated with feature feat.
|
int |
size()
returns the number of features in the FeatureSet.
|
boolean |
subsetOf(FeatureSet fs)
returns true if the FeatureSet is contained in
fs: if
every feature in the FeatureSet is present in fs with the
same value. |
FeatureSet |
substitute(HashMap bindings)
Returns a new feature set in which every value of the original feature
set which is a variable has been replace by the binding of that variable
in bindings.
|
String |
toSGMLString()
returns a string representation of the feature set, without enclosing
braces, of the form
feature1=value1 feature2=value2 ... which is suitable when the feature set is part of an annotation or SGML tag. |
String |
toSGMLString(int nestingLimit,
boolean useIds,
boolean quoteValues)
returns a string representation of the feature set, without enclosing
braces, of the form
feature1=value1 feature2=value2 ... which is suitable when the feature set is part of an annotation or SGML tag. |
String |
toString()
returns a printable form of the feature set, of the form
[feature1=value1 feature2=value2 ...]. |
static FeatureSet |
unify(FeatureSet a,
FeatureSet b)
If every feature which occurs in both FeatureSets a and b
has the same value in both FeatureSets, returns a new FeatureSet with the
union of the features; otherwise returns null.
|
public FeatureSet()
public FeatureSet(String feat1, Object val1)
public FeatureSet(String feat1, Object val1, String feat2, Object val2)
public FeatureSet(String feat1, Object val1, String feat2, Object val2, String feat3, Object val3)
public FeatureSet(FeatureSet fs)
fs.public FeatureSet(StreamTokenizer tok, boolean allowVariables, char endChar) throws IOException, PatternSyntaxError
IOExceptionPatternSyntaxErrorpublic void put(String feat, Object val)
public void putAll(FeatureSet fs)
public void remove(String feat)
public boolean containsFeature(String feat)
null.public boolean subsetOf(FeatureSet fs)
fs: if
every feature in the FeatureSet is present in fs with the
same value.public boolean equals(FeatureSet fs)
public boolean equals(Object obj)
public Enumeration keys()
public int size()
public FeatureSet substitute(HashMap bindings)
public static FeatureSet unify(FeatureSet a, FeatureSet b)
public String toString()
public String toSGMLString()
public String toSGMLString(int nestingLimit, boolean useIds, boolean quoteValues)
nestingLimit - limit of depth of nested Annotations which will be represented
in the String.useIds - if true, references to Annotations which are nested more
deeply than 'nestingLimit' are rendered as '#nnn', where 'nnn'
is the 'id' feature of the referenced Annotation; if false,
these references are rendered as "..."quoteValues - if true, values of features are enclosed in double quotes, as
required by XML. Quotes inside quoted values are escaped
(preceded by a backslash).public void prepareToMakeString(int nestingLimit)
Copyright © 2016 New York University. All rights reserved.