gate.creole.ml
Class MachineLearningPR.Cache
java.lang.Object
gate.creole.ml.MachineLearningPR.Cache
- Enclosing class:
- MachineLearningPR
- protected class MachineLearningPR.Cache
- extends Object
Field Summary |
protected List |
backwardCache
Stores cached data with attribute values for instances placed
before the current instance. |
protected Map |
currentAttributes
A Map
with annotationTypes as keys. |
protected List |
forwardCache
Stores cached data with attribute values for instances placed
after the current instance. |
Method Summary |
String |
getAttributeValue(int instanceIndex,
Attribute attribute)
Finds the value of a specified attribute for a particular instance. |
protected String |
getValue(Attribute attribute,
int instanceIndex,
Map cache)
Finds the value for a particular attribute and returns it. |
void |
shift()
Notifies the cache that it should advance its internal structures one
step forward. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
forwardCache
protected List forwardCache
- Stores cached data with attribute values for instances placed
after the current instance.
For each instance (i.e. for each position in the list) the data is a Map
with annotationTypes as keys. For each annotation type the data stored is
another Map with feature names as keys and feature values as values.
The null key is used for a boolean value (stored as one of the
"true" or "false" strings) signifying the presence
(or lack of presence) of the required type of annotation at the location.
forwardCache[2].get("Lookup").get(null) == "false" means that no lookup
annotation covers the second instance to the right from the current
instance.
backwardCache
protected List backwardCache
- Stores cached data with attribute values for instances placed
before the current instance.
For each instance (i.e. for each position in the list) the data is a Map
with annotationTypes as keys. For each annotation type the data stored is
another Map with feature names as keys and feature values as values.
The null key is used for a boolean value (stored as one of the
"true" or "false" strings) signifying the presence
(or lack of presence) of the required type of annotation at the location.
backwardCache[2].get("Lookup").get(null) == "false" means that no lookup
annotation covers the second instance to the left from the current
instance.
currentAttributes
protected Map currentAttributes
- A Map
with annotationTypes as keys. For each annotation type the data stored is
another Map with feature names as keys and feature values as values.
The null key is used for a boolean value (stored as one of the
"true" or "false" strings) signifying the presence
(or lack of presence) of the required type of annotation at the location.
currentAttributes.get(Lookup).get(null) == "false" means that the current
instance is not covered by a Lookup annotation.
currentAttributes.get(Lookup) == null menas nothing is known about Lookup
annotations caovering the current instance.
MachineLearningPR.Cache
public MachineLearningPR.Cache()
getAttributeValue
public String getAttributeValue(int instanceIndex,
Attribute attribute)
- Finds the value of a specified attribute for a particular instance.
- Parameters:
instanceIndex
- the index of the current instance in the annotations
List.attribute
- the attribute whose value needs to be found
- Returns:
- a String representing the value for the attribute.
shift
public void shift()
- Notifies the cache that it should advance its internal structures one
step forward.
getValue
protected String getValue(Attribute attribute,
int instanceIndex,
Map cache)
- Finds the value for a particular attribute and returns it.
If the value is not present in the cache it will be retrieved from the
document and the cache will be updated.
- Parameters:
attribute
- the attribute whose value is requested.cache
- the Map containing the cache for the appropriate position
for the attributeinstanceIndex
- the index of the instance annotation which is
covered by the sought attribute
- Returns:
- a String value.