MaltParser 1.0.2

org.maltparser.parser.guide
Class Guide

java.lang.Object
  extended by org.maltparser.parser.guide.Guide
All Implemented Interfaces:
GuideModel

public class Guide
extends Object
implements GuideModel

The guide is used by a parsing algorithm to predict the next parser action during parsing and to add a instance to the training instance set during learning.

Since:
1.0
Author:
Johan Hall

Constructor Summary
Guide(SingleMaltConfiguration configuration, ParsingAlgorithm parsingAlgorithm)
          Constructs a guide.
 
Method Summary
 void addInstance(ParserAction parserAction)
          Used by the parsing algorithm for adding a instance to the training instance set during learning.
 void finalize()
          Used for cleaning up the guide models and learner objects.
 void finalizeSentence(Sentence sentence, DependencyGraph dependencyGraph)
          Used when a sentence has been processed during learning.
 SingleMaltConfiguration getConfiguration()
          Returns the current MaltParser configuration object
 File getFile(String suffix)
           
 InputStreamReader getInputStreamReader(String suffix)
           
 String getModelName()
           
 OutputStreamWriter getOutputStreamWriter(String suffix)
           
 int getParserMode()
           
 ParsingAlgorithm getParsingAlgorithm()
          Returns the parsing algorithm
 Class<?> getPredictionStrategy()
          Returns a prediction strategy object (also know as a guide model)
 void initPredictionStrategy()
          Initialize prediction strategy (also know as a guide model)
 void noMoreInstances()
          Used when all training data has been processed during learning.
 boolean predict()
          Predicts the next parser action during parsing.
 boolean predictFromKBestList()
           
 void setConfiguration(SingleMaltConfiguration configuration)
          Sets the current MaltParser configuration object
 void setParsingAlgorithm(ParsingAlgorithm parsingAlgorithm)
          Sets the parsing algorithm that use the guide to predict the next parser action during parsing and to add a instance during learning.
 String toString()
           
 void updateCardinality()
          Updates all the features with latest cardinality (number of distinct values for a particular feature)
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Guide

public Guide(SingleMaltConfiguration configuration,
             ParsingAlgorithm parsingAlgorithm)
      throws MaltChainedException
Constructs a guide.

Parameters:
configuration - the current MaltParserConfiguration object
parsingAlgorithm - the parsing algorithm that uses the guide
Throws:
MaltChainedException
Method Detail

addInstance

public void addInstance(ParserAction parserAction)
                 throws MaltChainedException
Used by the parsing algorithm for adding a instance to the training instance set during learning.

Specified by:
addInstance in interface GuideModel
Parameters:
parserAction - the current parser action.
Throws:
MaltChainedException

finalizeSentence

public void finalizeSentence(Sentence sentence,
                             DependencyGraph dependencyGraph)
                      throws MaltChainedException
Used when a sentence has been processed during learning.

Specified by:
finalizeSentence in interface GuideModel
Parameters:
sentence - the current sentence
dependencyGraph - the current dependency graph
Throws:
MaltChainedException

noMoreInstances

public void noMoreInstances()
                     throws MaltChainedException
Used when all training data has been processed during learning.

Specified by:
noMoreInstances in interface GuideModel
Throws:
MaltChainedException

finalize

public void finalize()
              throws MaltChainedException
Used for cleaning up the guide models and learner objects. Should be invoked when the system is shutting down.

Specified by:
finalize in interface GuideModel
Overrides:
finalize in class Object
Throws:
MaltChainedException

predict

public boolean predict()
                throws MaltChainedException
Predicts the next parser action during parsing.

Specified by:
predict in interface GuideModel
Throws:
MaltChainedException

predictFromKBestList

public boolean predictFromKBestList()
                             throws MaltChainedException
Throws:
MaltChainedException

updateCardinality

public void updateCardinality()
                       throws MaltChainedException
Updates all the features with latest cardinality (number of distinct values for a particular feature)

Throws:
MaltChainedException

getPredictionStrategy

public Class<?> getPredictionStrategy()
Returns a prediction strategy object (also know as a guide model)

Returns:
a prediction strategy object (also know as a guide model)

initPredictionStrategy

public void initPredictionStrategy()
                            throws MaltChainedException
Initialize prediction strategy (also know as a guide model)

Throws:
MaltChainedException

getParsingAlgorithm

public ParsingAlgorithm getParsingAlgorithm()
Returns the parsing algorithm

Specified by:
getParsingAlgorithm in interface GuideModel
Returns:
the parsing algorithm

setParsingAlgorithm

public void setParsingAlgorithm(ParsingAlgorithm parsingAlgorithm)
Sets the parsing algorithm that use the guide to predict the next parser action during parsing and to add a instance during learning.

Parameters:
parsingAlgorithm - the parsing algorithm that use the guide

getConfiguration

public SingleMaltConfiguration getConfiguration()
Returns the current MaltParser configuration object

Specified by:
getConfiguration in interface GuideModel
Returns:
the current MaltParser configuration object

setConfiguration

public void setConfiguration(SingleMaltConfiguration configuration)
Sets the current MaltParser configuration object

Parameters:
configuration - the current MaltParser configuration object

getModelName

public String getModelName()
                    throws MaltChainedException
Specified by:
getModelName 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

getParserMode

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

toString

public String toString()
Overrides:
toString in class Object

MaltParser 1.0.2

Copyright 2007 Johan Hall, Jens Nilsson and Joakim Nivre.