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 CLASSIFYMaltChainedExceptionpublic void addInstance(SingleDecision decision, FeatureVector featureVector) throws MaltChainedException
addInstance in interface LearningMethodMaltChainedExceptionpublic void finalizeSentence(DependencyStructure dependencyGraph) throws MaltChainedException
finalizeSentence in interface LearningMethodMaltChainedExceptionpublic void moveAllInstances(LearningMethod method, FeatureFunction divideFeature, java.util.ArrayList<java.lang.Integer> divideFeatureIndexVector) throws MaltChainedException
moveAllInstances in interface LearningMethodMaltChainedExceptionpublic void noMoreInstances() throws MaltChainedException
noMoreInstances in interface LearningMethodMaltChainedExceptionpublic boolean predict(FeatureVector featureVector, SingleDecision decision) throws MaltChainedException
predict in interface LearningMethodMaltChainedExceptionpublic void train() throws MaltChainedException
train in interface LearningMethodMaltChainedExceptionprotected abstract void trainExternal(java.lang.String pathExternalTrain, java.util.LinkedHashMap<java.lang.String,java.lang.String> libOptions) throws MaltChainedException
MaltChainedExceptionprotected abstract void trainInternal(java.util.LinkedHashMap<java.lang.String,java.lang.String> libOptions) throws MaltChainedException
MaltChainedExceptionpublic void terminate() throws MaltChainedException
terminate in interface LearningMethodMaltChainedExceptionpublic java.io.BufferedWriter getInstanceWriter()
getInstanceWriter in interface LearningMethodprotected void closeInstanceWriter() throws MaltChainedException
MaltChainedExceptionpublic InstanceModel getOwner()
public int getLearnerMode()
public java.lang.String getLearningMethodName()
public DependencyParserConfig getConfiguration() throws MaltChainedException
MaltChainedExceptionpublic int getNumberOfInstances() throws MaltChainedException
MaltChainedExceptionpublic void increaseNumberOfInstances()
increaseNumberOfInstances in interface LearningMethodpublic void decreaseNumberOfInstances()
decreaseNumberOfInstances in interface LearningMethodprotected void setNumberOfInstances(int numberOfInstances)
protected java.io.OutputStreamWriter getInstanceOutputStreamWriter(java.lang.String suffix) throws MaltChainedException
MaltChainedExceptionprotected java.io.InputStreamReader getInstanceInputStreamReader(java.lang.String suffix) throws MaltChainedException
MaltChainedExceptionprotected java.io.InputStream getInputStreamFromConfigFileEntry(java.lang.String suffix) throws MaltChainedException
MaltChainedExceptionprotected java.io.File getFile(java.lang.String suffix) throws MaltChainedException
MaltChainedExceptionprotected java.lang.Object getConfigFileEntryObject(java.lang.String suffix) throws MaltChainedException
MaltChainedExceptionpublic 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
MaltChainedExceptionprotected void finalize() throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic java.lang.String toString()
toString in class java.lang.Objectprotected int binariesInstance(java.lang.String line, FeatureList featureList) throws MaltChainedException
MaltChainedExceptionprotected void binariesInstances2SVMFileFormat(java.io.InputStreamReader isr, java.io.OutputStreamWriter osw) throws MaltChainedException
MaltChainedExceptionprotected void saveFeatureMap(java.io.OutputStream os, FeatureMap map) throws MaltChainedException
MaltChainedExceptionprotected FeatureMap loadFeatureMap(java.io.InputStream is) throws MaltChainedException
MaltChainedExceptionCopyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.