public abstract class BaseModel
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
BaseModel(BaseModel other) |
BaseModel(ShiftReduceOptions op,
Index<Transition> transitionIndex,
java.util.Set<java.lang.String> knownStates,
java.util.Set<java.lang.String> rootStates,
java.util.Set<java.lang.String> rootOnlyStates) |
Modifier and Type | Method and Description |
---|---|
Transition |
findEmergencyTransition(State state,
java.util.List<ParserConstraint> constraints)
Returns a transition which might not even be part of the model,
but will hopefully allow progress in an otherwise stuck parse
TODO: perhaps we want to create an EmergencyTransition class
which indicates that something has gone wrong
|
abstract java.util.Collection<ScoredObject<java.lang.Integer>> |
findHighestScoringTransitions(State state,
boolean requireLegal,
int numTransitions,
java.util.List<ParserConstraint> constraints) |
abstract void |
trainModel(java.lang.String serializedPath,
Tagger tagger,
java.util.Random random,
java.util.List<Tree> binarizedTrainTrees,
java.util.List<java.util.List<Transition>> transitionLists,
Treebank devTreebank,
int nThreads)
Train a new model.
|
public BaseModel(ShiftReduceOptions op, Index<Transition> transitionIndex, java.util.Set<java.lang.String> knownStates, java.util.Set<java.lang.String> rootStates, java.util.Set<java.lang.String> rootOnlyStates)
public BaseModel(BaseModel other)
public Transition findEmergencyTransition(State state, java.util.List<ParserConstraint> constraints)
public abstract java.util.Collection<ScoredObject<java.lang.Integer>> findHighestScoringTransitions(State state, boolean requireLegal, int numTransitions, java.util.List<ParserConstraint> constraints)
public abstract void trainModel(java.lang.String serializedPath, Tagger tagger, java.util.Random random, java.util.List<Tree> binarizedTrainTrees, java.util.List<java.util.List<Transition>> transitionLists, Treebank devTreebank, int nThreads)
serializedPath
- Where serialized models go. If the appropriate options are set, the method can use this to save intermediate models.tagger
- The tagger to use when evaluating devTreebank. TODO: it would make more sense for ShiftReduceParser to retag the trees firstrandom
- A random number generator to use for any random numbers. Useful to make sure results can be reproduced.binarizedTrainTrees
- The treebank to train from.transitionLists
- binarizedTrainTrees converted into lists of transitions that will reproduce the same tree.devTreebank
- a set of trees which can be used for dev testing (assuming the user provided a dev treebank)nThreads
- how many threads the model can use for training