public abstract class Lib extends java.lang.Object implements LearningMethod
Modifier and Type | Class and Description |
---|---|
static class |
Lib.Verbostity |
Modifier and Type | Field and Description |
---|---|
protected FeatureMap |
featureMap |
protected MaltLibModel |
model |
protected Lib.Verbostity |
verbosity |
BATCH, CLASSIFY
Constructor and Description |
---|
Lib(InstanceModel owner,
java.lang.Integer learnerMode,
java.lang.String learningMethodName)
Constructs a Lib learner.
|
Modifier and Type | Method and Description |
---|---|
void |
addInstance(SingleDecision decision,
FeatureVector featureVector) |
protected int |
binariesInstance(java.lang.String line,
FeatureList featureList) |
protected void |
binariesInstances2SVMFileFormat(java.io.InputStreamReader isr,
java.io.OutputStreamWriter osw) |
protected void |
closeInstanceWriter() |
void |
decreaseNumberOfInstances() |
protected void |
finalize() |
void |
finalizeSentence(DependencyStructure dependencyGraph) |
abstract java.lang.String |
getAllowedLibOptionFlags() |
protected java.lang.Object |
getConfigFileEntryObject(java.lang.String suffix) |
DependencyParserConfig |
getConfiguration()
Returns the current configuration
|
abstract java.util.LinkedHashMap<java.lang.String,java.lang.String> |
getDefaultLibOptions() |
protected java.io.File |
getFile(java.lang.String suffix) |
protected java.io.InputStream |
getInputStreamFromConfigFileEntry(java.lang.String suffix) |
protected java.io.InputStreamReader |
getInstanceInputStreamReader(java.lang.String suffix) |
protected java.io.OutputStreamWriter |
getInstanceOutputStreamWriter(java.lang.String suffix) |
java.io.BufferedWriter |
getInstanceWriter() |
int |
getLearnerMode() |
java.lang.String |
getLearningMethodName() |
java.lang.String[] |
getLibParamStringArray(java.util.LinkedHashMap<java.lang.String,java.lang.String> libOptions) |
int |
getNumberOfInstances() |
InstanceModel |
getOwner() |
void |
increaseNumberOfInstances() |
protected FeatureMap |
loadFeatureMap(java.io.InputStream is) |
void |
moveAllInstances(LearningMethod method,
FeatureFunction divideFeature,
java.util.ArrayList<java.lang.Integer> divideFeatureIndexVector) |
void |
noMoreInstances() |
void |
parseParameters(java.lang.String paramstring,
java.util.LinkedHashMap<java.lang.String,java.lang.String> libOptions,
java.lang.String allowedLibOptionFlags) |
boolean |
predict(FeatureVector featureVector,
SingleDecision decision) |
protected void |
saveFeatureMap(java.io.OutputStream os,
FeatureMap map) |
protected void |
setNumberOfInstances(int numberOfInstances) |
void |
terminate() |
java.lang.String |
toString() |
void |
train() |
protected abstract void |
trainExternal(java.lang.String pathExternalTrain,
java.util.LinkedHashMap<java.lang.String,java.lang.String> libOptions) |
protected abstract void |
trainInternal(java.util.LinkedHashMap<java.lang.String,java.lang.String> libOptions) |
protected final Lib.Verbostity verbosity
protected final FeatureMap featureMap
protected MaltLibModel model
public Lib(InstanceModel owner, java.lang.Integer learnerMode, java.lang.String learningMethodName) throws MaltChainedException
owner
- the guide model ownerlearnerMode
- the mode of the learner BATCH or CLASSIFYMaltChainedException
public void addInstance(SingleDecision decision, FeatureVector featureVector) throws MaltChainedException
addInstance
in interface LearningMethod
MaltChainedException
public void finalizeSentence(DependencyStructure dependencyGraph) throws MaltChainedException
finalizeSentence
in interface LearningMethod
MaltChainedException
public void moveAllInstances(LearningMethod method, FeatureFunction divideFeature, java.util.ArrayList<java.lang.Integer> divideFeatureIndexVector) throws MaltChainedException
moveAllInstances
in interface LearningMethod
MaltChainedException
public void noMoreInstances() throws MaltChainedException
noMoreInstances
in interface LearningMethod
MaltChainedException
public boolean predict(FeatureVector featureVector, SingleDecision decision) throws MaltChainedException
predict
in interface LearningMethod
MaltChainedException
public void train() throws MaltChainedException
train
in interface LearningMethod
MaltChainedException
protected abstract void trainExternal(java.lang.String pathExternalTrain, java.util.LinkedHashMap<java.lang.String,java.lang.String> libOptions) throws MaltChainedException
MaltChainedException
protected abstract void trainInternal(java.util.LinkedHashMap<java.lang.String,java.lang.String> libOptions) throws MaltChainedException
MaltChainedException
public void terminate() throws MaltChainedException
terminate
in interface LearningMethod
MaltChainedException
public java.io.BufferedWriter getInstanceWriter()
getInstanceWriter
in interface LearningMethod
protected void closeInstanceWriter() throws MaltChainedException
MaltChainedException
public InstanceModel getOwner()
public int getLearnerMode()
public java.lang.String getLearningMethodName()
public DependencyParserConfig getConfiguration() throws MaltChainedException
MaltChainedException
public int getNumberOfInstances() throws MaltChainedException
MaltChainedException
public void increaseNumberOfInstances()
increaseNumberOfInstances
in interface LearningMethod
public void decreaseNumberOfInstances()
decreaseNumberOfInstances
in interface LearningMethod
protected void setNumberOfInstances(int numberOfInstances)
protected java.io.OutputStreamWriter getInstanceOutputStreamWriter(java.lang.String suffix) throws MaltChainedException
MaltChainedException
protected java.io.InputStreamReader getInstanceInputStreamReader(java.lang.String suffix) throws MaltChainedException
MaltChainedException
protected java.io.InputStream getInputStreamFromConfigFileEntry(java.lang.String suffix) throws MaltChainedException
MaltChainedException
protected java.io.File getFile(java.lang.String suffix) throws MaltChainedException
MaltChainedException
protected java.lang.Object getConfigFileEntryObject(java.lang.String suffix) throws MaltChainedException
MaltChainedException
public java.lang.String[] getLibParamStringArray(java.util.LinkedHashMap<java.lang.String,java.lang.String> libOptions)
public abstract java.util.LinkedHashMap<java.lang.String,java.lang.String> getDefaultLibOptions()
public abstract java.lang.String getAllowedLibOptionFlags()
public void parseParameters(java.lang.String paramstring, java.util.LinkedHashMap<java.lang.String,java.lang.String> libOptions, java.lang.String allowedLibOptionFlags) throws MaltChainedException
MaltChainedException
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.lang.String toString()
toString
in class java.lang.Object
protected int binariesInstance(java.lang.String line, FeatureList featureList) throws MaltChainedException
MaltChainedException
protected void binariesInstances2SVMFileFormat(java.io.InputStreamReader isr, java.io.OutputStreamWriter osw) throws MaltChainedException
MaltChainedException
protected void saveFeatureMap(java.io.OutputStream os, FeatureMap map) throws MaltChainedException
MaltChainedException
protected FeatureMap loadFeatureMap(java.io.InputStream is) throws MaltChainedException
MaltChainedException
Copyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.