gate.creole.ml.maxent
Class GateEventStream

java.lang.Object
  extended bygate.creole.ml.maxent.GateEventStream
All Implemented Interfaces:
opennlp.maxent.EventStream

public class GateEventStream
extends Object
implements opennlp.maxent.EventStream

This class is used by MaxentWrapper. When created, it is passed a data structure containg all the training data for the classifier. It can then provide this data to the maxent model itself, as needed.


Field Summary
(package private)  boolean DEBUG
           
(package private)  int index
           
(package private)  int indexOfOutcome
           
(package private)  List trainingData
           
 
Constructor Summary
(package private) GateEventStream(List newTrainingData, int newIndexOfOutcome)
          This constructor stores all the training data in the object when the object is created.
 
Method Summary
 boolean hasNext()
          See whether there are any more instances to be extracted from this object.
private  opennlp.maxent.Event instance2Event(List instance)
          Convert an instance into an Event object, taking note of the position of the outcome (class attribute) stored in this object.
 opennlp.maxent.Event nextEvent()
          Extract the next instance from those stored in this object, and advance the objects internal index to point at the next instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

boolean DEBUG

trainingData

final List trainingData

indexOfOutcome

final int indexOfOutcome

index

int index
Constructor Detail

GateEventStream

GateEventStream(List newTrainingData,
                int newIndexOfOutcome)
This constructor stores all the training data in the object when the object is created.

Parameters:
newTrainingData - A List of Lists of String objects. Each String is a maxent feature or outcome.
newIndexOfOutcome - This is the index of the String objects that are the outcomes.
Method Detail

nextEvent

public opennlp.maxent.Event nextEvent()
Extract the next instance from those stored in this object, and advance the objects internal index to point at the next instance. An exception will be thrown if this method is called when there are no more instances to extract.

Specified by:
nextEvent in interface opennlp.maxent.EventStream
Returns:
The next instance.

hasNext

public boolean hasNext()
See whether there are any more instances to be extracted from this object.

Specified by:
hasNext in interface opennlp.maxent.EventStream
Returns:
true if there are more instances, false otherwise.

instance2Event

private opennlp.maxent.Event instance2Event(List instance)
Convert an instance into an Event object, taking note of the position of the outcome (class attribute) stored in this object.

Parameters:
instance - The instance in the form of a list of String objects.
Returns:
A maxent Event object containing the outcome (class attribute) and the features (other attributes).