MaltParser 1.0.3

org.maltparser.parser.guide.instmodel
Class AtomicModel

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

public class AtomicModel
extends Object
implements InstanceModel

Since:
1.0
Author:
Johan Hall

Constructor Summary
AtomicModel(int index, FeatureVector features, ClassTable classCodeTable, GuideModel parent)
          Constructs an atomic model.
 
Method Summary
 void addInstance(ParserAction parserAction)
           
 void decreaseFrequency()
           
 void finalize()
           
 void finalizeSentence(Sentence sentence, DependencyGraph dependencyGraph)
           
 ClassTable getClassCodeTable()
          Returns a class table object
 SingleMaltConfiguration getConfiguration()
           
 FeatureVector getFeatures()
          Returns the feature vector used by this atomic model
 File getFile(String suffix)
           
 Integer getFrequency()
          Returns the frequency (number of instances)
 Integer getIndex()
          Returns the index of the atomic model
 InputStreamReader getInputStreamReader(String suffix)
           
 LearningMethod getMethod()
          Returns a learner object
 String getModelName()
           
 OutputStreamWriter getOutputStreamWriter(String suffix)
           
 GuideModel getParent()
          Returns the parent guide model
 int getParserMode()
           
 ParsingAlgorithm getParsingAlgorithm()
           
 void increaseFrequency()
          Increase the frequency by 1
 void initMethod()
          Initialize the learning method according to the option --learner-method.
 void moveAllInstances(AtomicModel model, Feature 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()
           
protected  void setClassCodeTable(ClassTable classCodeTable)
          Sets the class table
protected  void setFeatures(FeatureVector features)
          Sets the feature vector used by the atomic model.
protected  void setFrequency(Integer frequency)
          Sets the frequency (number of instances)
protected  void setIndex(Integer 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(GuideModel parent)
          Sets the parent guide model
 String toString()
           
 void train()
          Invokes the train() of the learning method
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AtomicModel

public AtomicModel(int index,
                   FeatureVector features,
                   ClassTable classCodeTable,
                   GuideModel 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.
classCodeTable - the class code table used by the atomic model.
parent - the parent guide model.
Throws:
MaltChainedException
Method Detail

addInstance

public void addInstance(ParserAction parserAction)
                 throws MaltChainedException
Specified by:
addInstance in interface GuideModel
Throws:
MaltChainedException

noMoreInstances

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

finalizeSentence

public void finalizeSentence(Sentence sentence,
                             DependencyGraph dependencyGraph)
                      throws MaltChainedException
Specified by:
finalizeSentence in interface GuideModel
Throws:
MaltChainedException

predict

public boolean predict()
                throws MaltChainedException
Specified by:
predict in interface GuideModel
Throws:
MaltChainedException

finalize

public void finalize()
              throws MaltChainedException
Specified by:
finalize in interface GuideModel
Overrides:
finalize in class Object
Throws:
MaltChainedException

moveAllInstances

public void moveAllInstances(AtomicModel model,
                             Feature 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 GuideModel getParent()
                     throws MaltChainedException
Returns the parent guide model

Returns:
the parent guide model
Throws:
MaltChainedException

setParent

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

Parameters:
parent - the parent guide model

getModelName

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

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

getClassCodeTable

public ClassTable getClassCodeTable()
Returns a class table object

Returns:
a class table object

setClassCodeTable

protected void setClassCodeTable(ClassTable classCodeTable)
Sets the class table

Parameters:
classCodeTable - a class table object

getParsingAlgorithm

public ParsingAlgorithm getParsingAlgorithm()
                                     throws MaltChainedException
Specified by:
getParsingAlgorithm in interface GuideModel
Throws:
MaltChainedException

getConfiguration

public SingleMaltConfiguration getConfiguration()
                                         throws MaltChainedException
Specified by:
getConfiguration in interface GuideModel
Throws:
MaltChainedException

getParserMode

public int getParserMode()
                  throws MaltChainedException
Specified by:
getParserMode in interface GuideModel
Throws:
MaltChainedException

getOutputStreamWriter

public OutputStreamWriter getOutputStreamWriter(String suffix)
                                         throws MaltChainedException
Specified by:
getOutputStreamWriter in interface GuideModel
Throws:
MaltChainedException

getInputStreamReader

public InputStreamReader getInputStreamReader(String suffix)
                                       throws MaltChainedException
Specified by:
getInputStreamReader in interface GuideModel
Throws:
MaltChainedException

getFile

public File getFile(String suffix)
             throws MaltChainedException
Specified by:
getFile in interface GuideModel
Throws:
MaltChainedException

getIndex

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

Returns:
the index of the atomic model

setIndex

protected void setIndex(Integer 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 Integer 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(Integer 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.0.3

Copyright 2007 Johan Hall, Jens Nilsson and Joakim Nivre.