public class DVModel extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
TwoDimensionalMap<String,String,org.ejml.simple.SimpleMatrix> |
binaryScore |
TwoDimensionalMap<String,String,org.ejml.simple.SimpleMatrix> |
binaryTransform |
Map<String,org.ejml.simple.SimpleMatrix> |
unaryScore |
Map<String,org.ejml.simple.SimpleMatrix> |
unaryTransform |
Map<String,org.ejml.simple.SimpleMatrix> |
wordVectors |
Constructor and Description |
---|
DVModel(Options op,
Index<String> stateIndex,
UnaryGrammar unaryGrammar,
BinaryGrammar binaryGrammar) |
DVModel(TwoDimensionalMap<String,String,org.ejml.simple.SimpleMatrix> binaryTransform,
Map<String,org.ejml.simple.SimpleMatrix> unaryTransform,
TwoDimensionalMap<String,String,org.ejml.simple.SimpleMatrix> binaryScore,
Map<String,org.ejml.simple.SimpleMatrix> unaryScore,
Map<String,org.ejml.simple.SimpleMatrix> wordVectors,
Options op) |
Modifier and Type | Method and Description |
---|---|
void |
addRandomBinaryMatrix(String leftBasic,
String rightBasic) |
void |
addRandomUnaryMatrix(String childBasic) |
String |
basicCategory(String category) |
int |
binaryScoreIndex(String leftChild,
String rightChild) |
int |
binaryTransformIndex(String leftChild,
String rightChild) |
void |
filterRulesForBatch(Collection<Tree> trees)
Filters the transform and score rules so that we only have the
ones which appear in the trees given
|
void |
filterRulesForBatch(Map<Tree,byte[]> compressedTrees) |
void |
filterRulesForBatch(TwoDimensionalSet<String,String> binaryRules,
Set<String> unaryRules,
Set<String> words) |
org.ejml.simple.SimpleMatrix |
getEndWordVector() |
org.ejml.simple.SimpleMatrix |
getScoreWForNode(Tree node) |
org.ejml.simple.SimpleMatrix |
getStartWordVector() |
org.ejml.simple.SimpleMatrix |
getUnknownWordVector() |
String |
getVocabWord(String word) |
org.ejml.simple.SimpleMatrix |
getWForNode(Tree node) |
org.ejml.simple.SimpleMatrix |
getWordVector(String word) |
Pair<String,String> |
indexToBinaryScore(int pos) |
Pair<String,String> |
indexToBinaryTransform(int pos) |
String |
indexToUnaryScore(int pos) |
String |
indexToUnaryTransform(int pos) |
double[] |
paramsToVector() |
double[] |
paramsToVector(double scale) |
void |
printAllMatrices(PrintStream out) |
void |
printMatrixNames(PrintStream out) |
void |
printMatrixStats(PrintStream out) |
void |
printParameterType(int pos,
PrintStream out)
Prints to stdout the type and key for the given location in the parameter stack
|
void |
readWordVectors() |
void |
setRulesForTrainingSet(List<Tree> sentences,
Map<Tree,byte[]> compressedTrees) |
int |
totalParamSize() |
int |
unaryScoreIndex(String child) |
int |
unaryTransformIndex(String child) |
void |
vectorToParams(double[] theta) |
public TwoDimensionalMap<String,String,org.ejml.simple.SimpleMatrix> binaryTransform
public TwoDimensionalMap<String,String,org.ejml.simple.SimpleMatrix> binaryScore
public DVModel(Options op, Index<String> stateIndex, UnaryGrammar unaryGrammar, BinaryGrammar binaryGrammar)
op
- the parameters of the parserpublic DVModel(TwoDimensionalMap<String,String,org.ejml.simple.SimpleMatrix> binaryTransform, Map<String,org.ejml.simple.SimpleMatrix> unaryTransform, TwoDimensionalMap<String,String,org.ejml.simple.SimpleMatrix> binaryScore, Map<String,org.ejml.simple.SimpleMatrix> unaryScore, Map<String,org.ejml.simple.SimpleMatrix> wordVectors, Options op)
public void addRandomUnaryMatrix(String childBasic)
public void setRulesForTrainingSet(List<Tree> sentences, Map<Tree,byte[]> compressedTrees)
public void filterRulesForBatch(Collection<Tree> trees)
public void filterRulesForBatch(TwoDimensionalSet<String,String> binaryRules, Set<String> unaryRules, Set<String> words)
public void readWordVectors()
public int totalParamSize()
public double[] paramsToVector(double scale)
public double[] paramsToVector()
public void vectorToParams(double[] theta)
public org.ejml.simple.SimpleMatrix getWForNode(Tree node)
public org.ejml.simple.SimpleMatrix getScoreWForNode(Tree node)
public org.ejml.simple.SimpleMatrix getStartWordVector()
public org.ejml.simple.SimpleMatrix getEndWordVector()
public org.ejml.simple.SimpleMatrix getWordVector(String word)
public org.ejml.simple.SimpleMatrix getUnknownWordVector()
public void printMatrixNames(PrintStream out)
public void printMatrixStats(PrintStream out)
public void printAllMatrices(PrintStream out)
public int unaryTransformIndex(String child)
public int unaryScoreIndex(String child)
public String indexToUnaryTransform(int pos)
public String indexToUnaryScore(int pos)
public void printParameterType(int pos, PrintStream out)