|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.io.BaseStorable
de.fu_berlin.ties.eval.FeatureCount
Keeps track of the average number of features and of unique features in context representations and of the average number of contexts in documents. Comment-only features are excluded when counting features; comments are ignored when comparing features.
Instances of this class are not thread-safe and must be synchronized externally, if required.
Field Summary | |
static String |
KEY_AVERAGE_CONTEXTS
Serialization key for the average number of context representations in a document. |
static String |
KEY_AVERAGE_FEATURES
Serialization key for the average number of features in a context representation. |
static String |
KEY_AVERAGE_UNIQUE_FEATURES
Serialization key for the average number of unique features in a context representation. |
static String |
KEY_CHARS
Serialization key for characters. |
static String |
KEY_CHARS_PER_CONTEXT
Serialization key for the average number of characters in a context representation. |
static String |
KEY_CHARS_PER_FEATURE
Serialization key for the average number of characters in a feature. |
static String |
KEY_CONTEXTS
Serialization key for context representations. |
static String |
KEY_DOCUMENTS
Serialization key for documents. |
static String |
KEY_FEATURES
Serialization key for features. |
static String |
KEY_UNIQUE_FEATURES
Serialization key for unique features. |
Constructor Summary | |
FeatureCount()
Creates a new instance. |
|
FeatureCount(FieldMap fieldMap)
Creates a new instance from a field map, fulfilling the Storable contract. |
Method Summary | |
void |
countDocument()
Counts a document (increases the number of documents by one. |
double |
getAverageContexts()
Calculates and returns the average number of context representations in a document. |
double |
getAverageFeatures()
Calculates and returns the average number of non-comment features in a context representation. |
double |
getAverageUniqueFeatures()
Calculates and returns the average number of unique non-comment features in a context representation. |
long |
getCharacters()
Returns the number of characters counted so far. |
double |
getCharactersPerContext()
Calculates and returns the average number of characters in a context representation. |
double |
getCharactersPerFeature()
Calculates and returns the average number of characters in a feature. |
long |
getContexts()
Returns the number of representations evaluated so far. |
long |
getDocuments()
Returns the number of documents counted so far. |
long |
getFeatureSum()
Returns the number of non-comment features encountered so far. |
long |
getUniqueFeatureSum()
Returns the number of non-comment non-duplicate features encountered so far. |
FieldMap |
storeFields()
Stores all relevant fields of this object in a field map for serialization. |
void |
update(FeatureVector features)
Evaluates a feature vector and updates the statistics accordingly. |
Methods inherited from class de.fu_berlin.ties.io.BaseStorable |
toString, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String KEY_CONTEXTS
public static final String KEY_DOCUMENTS
public static final String KEY_FEATURES
public static final String KEY_CHARS
public static final String KEY_UNIQUE_FEATURES
public static final String KEY_AVERAGE_CONTEXTS
public static final String KEY_AVERAGE_FEATURES
public static final String KEY_AVERAGE_UNIQUE_FEATURES
public static final String KEY_CHARS_PER_CONTEXT
public static final String KEY_CHARS_PER_FEATURE
Constructor Detail |
public FeatureCount()
public FeatureCount(FieldMap fieldMap) throws IllegalArgumentException
Storable
contract.
fieldMap
- map containing the serialized fields
IllegalArgumentException
- if at least one of the parameters is
negative or missingMethod Detail |
public void countDocument()
public double getAverageContexts()
getAverageContexts
in interface FeatureCountView
public double getAverageFeatures()
getAverageFeatures
in interface FeatureCountView
public double getAverageUniqueFeatures()
getAverageUniqueFeatures
in interface FeatureCountView
public long getCharacters()
getCharacters
in interface FeatureCountView
public double getCharactersPerContext()
getCharactersPerContext
in interface FeatureCountView
public double getCharactersPerFeature()
getCharactersPerFeature
in interface FeatureCountView
public long getContexts()
getContexts
in interface FeatureCountView
public long getDocuments()
getDocuments
in interface FeatureCountView
public long getFeatureSum()
getFeatureSum
in interface FeatureCountView
public long getUniqueFeatureSum()
getUniqueFeatureSum
in interface FeatureCountView
public FieldMap storeFields()
FieldMap.createObject(Class)
on the created
field map. The calculated averages are also stored (they are ignored when
deserializing a stored instance).
storeFields
in interface Storable
public void update(FeatureVector features) throws ClassCastException
features
- a feature vector representing a context
ClassCastException
- if the list contains objects that aren't
Feature
s
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |