public abstract class DiscreteFeature extends Feature
DiscreteFeature
may take is defined in the Classifier
that
produced the feature.Modifier and Type | Field and Description |
---|---|
static String[] |
BooleanValues
Convient access to a common allowable value set.
|
protected short |
totalValues
The total number of allowable values for this feature.
|
protected short |
valueIndex
Index into the set of allowable values corresponding to this value.
|
containingPackage, generatingClassifier
Modifier and Type | Method and Description |
---|---|
Feature |
conjunction(Feature f,
Classifier c)
Create a feature representing the conjunction of this feature with the given argument
feature.
|
protected Feature |
conjunctWith(DiscreteFeature f,
Classifier c)
Create a feature representing the conjunction of this feature with the given argument
feature.
|
double |
getStrength()
Returns the strength of this feature if it were to be placed in a mathematical vector space.
|
short |
getValueIndex()
Returns the index in the generating classifier's value list of this feature's value.
|
boolean |
isDiscrete()
Determines if this feature is discrete.
|
void |
lexRead(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in,
Lexicon lex,
String p,
String g,
String si,
ByteString bi)
Reads the representation of a feature with this object's run-time type as stored by a
lexicon, overwriting the data in this object.
|
String |
lexWrite(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out,
Lexicon lex,
String c,
String p,
String g,
String si,
ByteString bi)
Writes a binary representation of the feature intended for use by a lexicon, omitting
redundant information when possible.
|
void |
read(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in)
Reads the representation of a feaeture with this object's run-time type from the given
stream, overwriting the data in this object.
|
short |
totalValues()
Returns the total number of values this feature might possibly be set to.
|
void |
write(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out)
Writes a complete binary representation of the feature.
|
childLexiconLookup, classEquivalent, clone, compareNameStrings, compareTo, conjunctWith, depth, encode, equals, fromArray, getByteStringIdentifier, getByteStringValue, getFeatureKey, getFeatureKey, getGeneratingClassifier, getPackage, getStringIdentifier, getStringValue, hasByteStringIdentifier, hashCode, hasStringIdentifier, isConjunctive, isPrimitive, isReferrer, lexReadFeature, makeReal, readFeature, removeFromChildLexicon, setArrayLength, toString, toStringNoPackage, valueEquals, withStrength, write, writeNameString, writeNoPackage
public static final String[] BooleanValues
protected short valueIndex
protected short totalValues
public boolean isDiscrete()
isDiscrete
in class Feature
true
iff this is discrete.public short getValueIndex()
getValueIndex
in class Feature
public short totalValues()
totalValues
in class Feature
public double getStrength()
getStrength
in class Feature
public Feature conjunction(Feature f, Classifier c)
conjunction
in class Feature
f
- The feature to conjunct with.c
- The classifier producing the resulting feature.f
.protected Feature conjunctWith(DiscreteFeature f, Classifier c)
conjunctWith
in class Feature
f
- The feature to conjunct with.c
- The classifier producing the resulting feature.f
.public void write(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out)
public void read(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in)
public String lexWrite(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out, Lexicon lex, String c, String p, String g, String si, ByteString bi)
lexWrite
in class Feature
out
- The output stream.lex
- The lexicon out of which this feature is being written.c
- The fully qualified name of the assumed class. The runtime class of this feature
won't be written if it's equivalent to c
.p
- The assumed package string. This feature's package string won't be written if it's
equivalent to p
.g
- The assumed classifier name string. This feature's classifier name string won't be
written if it's equivalent to g
.si
- The assumed identifier as a string. If this feature has a string identifier, it
won't be written if it's equivalent to si
.bi
- The assumed identifier as a byte string. If this feature has a byte string
identifier, it won't be written if it's equivalent to bi
.public void lexRead(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in, Lexicon lex, String p, String g, String si, ByteString bi)
This method is appropriate for reading features as written by
lexWrite(ExceptionlessOutputStream,Lexicon,String,String,String,String,ByteString)
.
lexRead
in class Feature
in
- The input stream.lex
- The lexicon we are reading in to.p
- The assumed package string. If no package name is given in the input stream, the
instantiated feature is given this package.g
- The assumed classifier name string. If no classifier name is given in the input
stream, the instantiated feature is given this classifier name.si
- The assumed identifier as a string. If the feature being read has a string
identifier field and no identifier is given in the input stream, the feature is given
this identifier.bi
- The assumed identifier as a byte string. If the feature being read has a byte
string identifier field and no identifier is given in the input stream, the feature is
given this identifier.Copyright © 2016. All rights reserved.