MaltParser 1.4.1

org.maltparser.parser.guide.instance
Class AtomicModel

java.lang.Object
  extended by org.maltparser.parser.guide.instance.AtomicModel
All Implemented Interfaces:
InstanceModel, Model

public class AtomicModel
extends Object
implements InstanceModel

Since:
1.0
Author:
Johan Hall

Constructor Summary
AtomicModel(int index, FeatureVector features, Model parent)
          Constructs an atomic model.
 
Method Summary
 void addInstance(SingleDecision decision)
           
 void decreaseFrequency()
           
 FeatureVector extract()
           
 void finalizeSentence(DependencyStructure dependencyGraph)
           
 FeatureVector getFeatures()
          Returns the feature vector used by this atomic model
 int getFrequency()
          Returns the frequency (number of instances)
 ClassifierGuide getGuide()
           
 int getIndex()
          Returns the index of the atomic model
 LearningMethod getMethod()
          Returns a learner object
 String getModelName()
           
 Model getParent()
          Returns the parent guide model
 void increaseFrequency()
          Increase the frequency by 1
 void initMethod()
          Initialize the learning method according to the option --learner-method.
 void moveAllInstances(AtomicModel model, FeatureFunction divideFeature, ArrayList<Integer> divideFeatureIndexVector)
          Moves all instance from this atomic model into the destination atomic model and add the divide feature.
 void noMoreInstances()
           
 boolean predict(SingleDecision decision)
           
 FeatureVector predictExtract(SingleDecision decision)
           
protected  void setFeatures(FeatureVector features)
          Sets the feature vector used by the atomic model.
protected  void setFrequency(int frequency)
          Sets the frequency (number of instances)
protected  void setIndex(int index)
          Sets the index of the model (-1..n), where -1 is a special value.
protected  void setModelName(String modelName)
          Sets the name of the atomic model
protected  void setParent(Model parent)
          Sets the parent guide model
 void terminate()
           
 String toString()
           
 void train()
          Invokes the train() of the learning method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AtomicModel

public AtomicModel(int index,
                   FeatureVector features,
                   Model parent)
            throws MaltChainedException
Constructs an atomic model.

Parameters:
index - the index of the atomic model (-1..n), where -1 is special value (used by a single model or the master divide model) and n is number of divide models.
features - the feature vector used by the atomic model.
parent - the parent guide model.
Throws:
MaltChainedException
Method Detail

addInstance

public void addInstance(SingleDecision decision)
                 throws MaltChainedException
Specified by:
addInstance in interface InstanceModel
Throws:
MaltChainedException

noMoreInstances

public void noMoreInstances()
                     throws MaltChainedException
Specified by:
noMoreInstances in interface Model
Throws:
MaltChainedException

finalizeSentence

public void finalizeSentence(DependencyStructure dependencyGraph)
                      throws MaltChainedException
Specified by:
finalizeSentence in interface Model
Throws:
MaltChainedException

predict

public boolean predict(SingleDecision decision)
                throws MaltChainedException
Specified by:
predict in interface InstanceModel
Throws:
MaltChainedException

predictExtract

public FeatureVector predictExtract(SingleDecision decision)
                             throws MaltChainedException
Specified by:
predictExtract in interface InstanceModel
Throws:
MaltChainedException

extract

public FeatureVector extract()
                      throws MaltChainedException
Specified by:
extract in interface InstanceModel
Throws:
MaltChainedException

terminate

public void terminate()
               throws MaltChainedException
Specified by:
terminate in interface Model
Throws:
MaltChainedException

moveAllInstances

public void moveAllInstances(AtomicModel model,
                             FeatureFunction divideFeature,
                             ArrayList<Integer> divideFeatureIndexVector)
                      throws MaltChainedException
Moves all instance from this atomic model into the destination atomic model and add the divide feature. This method is used by the feature divide model to sum up all model below a certain threshold.

Parameters:
model - the destination atomic model
divideFeature - the divide feature
divideFeatureIndexVector - the divide feature index vector
Throws:
MaltChainedException

train

public void train()
           throws MaltChainedException
Invokes the train() of the learning method

Specified by:
train in interface InstanceModel
Throws:
MaltChainedException

initMethod

public void initMethod()
                throws MaltChainedException
Initialize the learning method according to the option --learner-method.

Throws:
MaltChainedException

getParent

public Model getParent()
                throws MaltChainedException
Returns the parent guide model

Returns:
the parent guide model
Throws:
MaltChainedException

setParent

protected void setParent(Model parent)
Sets the parent guide model

Parameters:
parent - the parent guide model

getModelName

public String getModelName()
Specified by:
getModelName in interface Model

setModelName

protected void setModelName(String modelName)
Sets the name of the atomic model

Parameters:
modelName - the name of the atomic model

getFeatures

public FeatureVector getFeatures()
Returns the feature vector used by this atomic model

Returns:
a feature vector object

setFeatures

protected void setFeatures(FeatureVector features)
Sets the feature vector used by the atomic model.

Parameters:
features - a feature vector object

getGuide

public ClassifierGuide getGuide()
Specified by:
getGuide in interface Model

getIndex

public int getIndex()
Returns the index of the atomic model

Returns:
the index of the atomic model

setIndex

protected void setIndex(int index)
Sets the index of the model (-1..n), where -1 is a special value.

Parameters:
index - index value (-1..n) of the atomic model

getFrequency

public int getFrequency()
Returns the frequency (number of instances)

Returns:
the frequency (number of instances)

increaseFrequency

public void increaseFrequency()
Increase the frequency by 1

Specified by:
increaseFrequency in interface InstanceModel

decreaseFrequency

public void decreaseFrequency()
Specified by:
decreaseFrequency in interface InstanceModel

setFrequency

protected void setFrequency(int frequency)
Sets the frequency (number of instances)

Parameters:
frequency - (number of instances)

getMethod

public LearningMethod getMethod()
Returns a learner object

Returns:
a learner object

toString

public String toString()
Overrides:
toString in class Object

MaltParser 1.4.1

Copyright 2007-2010 Johan Hall, Jens Nilsson and Joakim Nivre.