MaltParser 1.5.2

org.maltparser.ml.lib
Class Lib

java.lang.Object
  extended by org.maltparser.ml.lib.Lib
All Implemented Interfaces:
LearningMethod
Direct Known Subclasses:
LibLinear, LibSvm

public abstract class Lib
extends Object
implements LearningMethod


Nested Class Summary
static class Lib.Verbostity
           
 
Field Summary
protected  String allowedLibOptionFlags
           
protected  org.apache.log4j.Logger configLogger
           
protected  boolean excludeNullValues
           
protected  FeatureMap featureMap
           
protected  BufferedWriter instanceOutput
           
protected  int learnerMode
           
protected  LinkedHashMap<String,String> libOptions
           
protected  MaltLibModel model
           
protected  String name
           
protected  int numberOfInstances
           
protected  InstanceModel owner
           
protected  String paramString
           
protected  String pathExternalTrain
           
protected  Pattern pipePattern
           
protected  boolean saveInstanceFiles
           
protected  Pattern tabPattern
           
protected  Lib.Verbostity verbosity
           
 
Fields inherited from interface org.maltparser.ml.LearningMethod
BATCH, CLASSIFY
 
Constructor Summary
Lib(InstanceModel owner, Integer learnerMode, String learningMethodName)
          Constructs a Lib learner.
 
Method Summary
 void addInstance(SingleDecision decision, FeatureVector featureVector)
           
protected  int binariesInstance(String line, FeatureList featureList)
           
protected  void binariesInstances2SVMFileFormat(InputStreamReader isr, OutputStreamWriter osw)
           
protected  void closeInstanceWriter()
           
 void decreaseNumberOfInstances()
           
protected  void finalize()
           
 void finalizeSentence(DependencyStructure dependencyGraph)
           
protected  JarEntry getConfigFileEntry(String suffix)
           
 DependencyParserConfig getConfiguration()
          Returns the current configuration
protected  File getFile(String suffix)
           
protected  InputStream getInputStreamFromConfigFileEntry(String suffix)
           
protected  InputStreamReader getInstanceInputStreamReader(String suffix)
           
protected  InputStreamReader getInstanceInputStreamReaderFromConfigFile(String suffix)
           
protected  OutputStreamWriter getInstanceOutputStreamWriter(String suffix)
           
 BufferedWriter getInstanceWriter()
           
 int getLearnerMode()
           
 String getLearningMethodName()
           
 String getLibOptions()
           
 String[] getLibParamStringArray()
           
 int getNumberOfInstances()
           
 InstanceModel getOwner()
           
 String getParamString()
          Returns the parameter string used for configure the learner
 String getPathExternalTrain()
           
 void increaseNumberOfInstances()
           
abstract  void initAllowedLibOptionFlags()
           
abstract  void initLibOptions()
           
protected  void initSpecialParameters()
           
protected  FeatureMap loadFeatureMap(InputStream is)
           
 void moveAllInstances(LearningMethod method, FeatureFunction divideFeature, ArrayList<Integer> divideFeatureIndexVector)
           
 void noMoreInstances()
           
 void parseParameters(String paramstring)
           
 boolean predict(FeatureVector featureVector, SingleDecision decision)
           
protected  void saveFeatureMap(OutputStream os, FeatureMap map)
           
 void setLearnerMode(int learnerMode)
           
protected  void setLearningMethodName(String name)
           
protected  void setNumberOfInstances(int numberOfInstances)
           
protected  void setOwner(InstanceModel owner)
           
 void setPathExternalTrain(String pathExternalTrain)
           
 void terminate()
           
 String toString()
           
 void train(FeatureVector featureVector)
           
protected abstract  void trainExternal(FeatureVector featureVector)
           
protected abstract  void trainInternal(FeatureVector featureVector)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

verbosity

protected Lib.Verbostity verbosity

owner

protected InstanceModel owner

learnerMode

protected int learnerMode

name

protected String name

numberOfInstances

protected int numberOfInstances

saveInstanceFiles

protected boolean saveInstanceFiles

excludeNullValues

protected boolean excludeNullValues

instanceOutput

protected BufferedWriter instanceOutput

featureMap

protected FeatureMap featureMap

paramString

protected String paramString

pathExternalTrain

protected String pathExternalTrain

libOptions

protected LinkedHashMap<String,String> libOptions

allowedLibOptionFlags

protected String allowedLibOptionFlags

configLogger

protected org.apache.log4j.Logger configLogger

tabPattern

protected final Pattern tabPattern

pipePattern

protected final Pattern pipePattern

model

protected MaltLibModel model
Constructor Detail

Lib

public Lib(InstanceModel owner,
           Integer learnerMode,
           String learningMethodName)
    throws MaltChainedException
Constructs a Lib learner.

Parameters:
owner - the guide model owner
learnerMode - the mode of the learner BATCH or CLASSIFY
Throws:
MaltChainedException
Method Detail

addInstance

public void addInstance(SingleDecision decision,
                        FeatureVector featureVector)
                 throws MaltChainedException
Specified by:
addInstance in interface LearningMethod
Throws:
MaltChainedException

finalizeSentence

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

moveAllInstances

public void moveAllInstances(LearningMethod method,
                             FeatureFunction divideFeature,
                             ArrayList<Integer> divideFeatureIndexVector)
                      throws MaltChainedException
Specified by:
moveAllInstances in interface LearningMethod
Throws:
MaltChainedException

noMoreInstances

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

predict

public boolean predict(FeatureVector featureVector,
                       SingleDecision decision)
                throws MaltChainedException
Specified by:
predict in interface LearningMethod
Throws:
MaltChainedException

train

public void train(FeatureVector featureVector)
           throws MaltChainedException
Specified by:
train in interface LearningMethod
Throws:
MaltChainedException

trainExternal

protected abstract void trainExternal(FeatureVector featureVector)
                               throws MaltChainedException
Throws:
MaltChainedException

trainInternal

protected abstract void trainInternal(FeatureVector featureVector)
                               throws MaltChainedException
Throws:
MaltChainedException

terminate

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

getInstanceWriter

public BufferedWriter getInstanceWriter()
Specified by:
getInstanceWriter in interface LearningMethod

closeInstanceWriter

protected void closeInstanceWriter()
                            throws MaltChainedException
Throws:
MaltChainedException

getParamString

public String getParamString()
Returns the parameter string used for configure the learner

Returns:
the parameter string used for configure the learner

getOwner

public InstanceModel getOwner()

setOwner

protected void setOwner(InstanceModel owner)

getLearnerMode

public int getLearnerMode()

setLearnerMode

public void setLearnerMode(int learnerMode)
                    throws MaltChainedException
Throws:
MaltChainedException

getLearningMethodName

public String getLearningMethodName()

getConfiguration

public DependencyParserConfig getConfiguration()
                                        throws MaltChainedException
Returns the current configuration

Returns:
the current configuration
Throws:
MaltChainedException

getNumberOfInstances

public int getNumberOfInstances()
                         throws MaltChainedException
Throws:
MaltChainedException

increaseNumberOfInstances

public void increaseNumberOfInstances()
Specified by:
increaseNumberOfInstances in interface LearningMethod

decreaseNumberOfInstances

public void decreaseNumberOfInstances()
Specified by:
decreaseNumberOfInstances in interface LearningMethod

setNumberOfInstances

protected void setNumberOfInstances(int numberOfInstances)

setLearningMethodName

protected void setLearningMethodName(String name)

getPathExternalTrain

public String getPathExternalTrain()

setPathExternalTrain

public void setPathExternalTrain(String pathExternalTrain)

getInstanceOutputStreamWriter

protected OutputStreamWriter getInstanceOutputStreamWriter(String suffix)
                                                    throws MaltChainedException
Throws:
MaltChainedException

getInstanceInputStreamReader

protected InputStreamReader getInstanceInputStreamReader(String suffix)
                                                  throws MaltChainedException
Throws:
MaltChainedException

getInstanceInputStreamReaderFromConfigFile

protected InputStreamReader getInstanceInputStreamReaderFromConfigFile(String suffix)
                                                                throws MaltChainedException
Throws:
MaltChainedException

getInputStreamFromConfigFileEntry

protected InputStream getInputStreamFromConfigFileEntry(String suffix)
                                                 throws MaltChainedException
Throws:
MaltChainedException

getFile

protected File getFile(String suffix)
                throws MaltChainedException
Throws:
MaltChainedException

getConfigFileEntry

protected JarEntry getConfigFileEntry(String suffix)
                               throws MaltChainedException
Throws:
MaltChainedException

initSpecialParameters

protected void initSpecialParameters()
                              throws MaltChainedException
Throws:
MaltChainedException

getLibOptions

public String getLibOptions()

getLibParamStringArray

public String[] getLibParamStringArray()

initLibOptions

public abstract void initLibOptions()

initAllowedLibOptionFlags

public abstract void initAllowedLibOptionFlags()

parseParameters

public void parseParameters(String paramstring)
                     throws MaltChainedException
Throws:
MaltChainedException

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

toString

public String toString()
Overrides:
toString in class Object

binariesInstance

protected int binariesInstance(String line,
                               FeatureList featureList)
                        throws MaltChainedException
Throws:
MaltChainedException

binariesInstances2SVMFileFormat

protected void binariesInstances2SVMFileFormat(InputStreamReader isr,
                                               OutputStreamWriter osw)
                                        throws MaltChainedException
Throws:
MaltChainedException

saveFeatureMap

protected void saveFeatureMap(OutputStream os,
                              FeatureMap map)
                       throws MaltChainedException
Throws:
MaltChainedException

loadFeatureMap

protected FeatureMap loadFeatureMap(InputStream is)
                             throws MaltChainedException
Throws:
MaltChainedException

MaltParser 1.5.2

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