|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.tagger.maxent.TestSentence
public class TestSentence
Field Summary | |
---|---|
protected java.lang.String[] |
correctTags
|
protected static boolean |
DBG
|
protected static boolean |
doDeterministicTagExpansion
|
protected java.lang.String |
encoding
|
protected java.lang.String[] |
finalTags
|
protected static int |
kBestSize
|
protected double[][] |
localContextScores
|
protected java.util.Map<java.lang.String,double[]> |
localScores
|
protected MaxentTagger |
maxentTagger
|
protected static java.lang.String |
naTag
|
protected java.util.List<HasWord> |
origWords
|
protected PairsHolder |
pairs
|
protected java.util.List<java.lang.String> |
sent
|
protected int |
size
|
protected java.lang.String |
tagSeparator
|
protected static boolean |
VERBOSE
|
Constructor Summary | |
---|---|
TestSentence(MaxentTagger maxentTagger)
|
|
TestSentence(MaxentTagger maxentTagger,
java.lang.String[] s,
java.lang.String[] correctTags,
PrintFile pf,
Dictionary wrongWords,
boolean verboseResults)
|
Method Summary | |
---|---|
protected java.lang.String[] |
append(java.lang.String[] tags,
java.lang.String word)
|
protected void |
calculateProbs(double[][][] probabilities)
calculateProbs puts log probs of taggings in the probabilities array. |
protected void |
cleanUpScorer()
clean-up after the scorer |
protected double[] |
getHistories(java.lang.String[] tags,
History h)
|
int[] |
getPossibleValues(int pos)
0...leftWindow-1 etc are null, leftWindow...length+leftWindow-1 are words, length+leftWindow...length+leftWindow+rightWindow-1 are null; |
protected void |
init()
|
protected void |
initializeScorer()
|
int |
leftWindow()
How many positions to the left a position is dependent on. |
int |
length()
|
protected void |
revert(int prevSize)
|
int |
rightWindow()
How many positions to the right a position is dependent on. |
double |
scoreOf(int[] sequence)
Computes the score assigned by this model to the whole sequence. |
double |
scoreOf(int[] tags,
int pos)
Computes the unnormalized log conditional distribution over values of the element at position pos in the sequence, conditioned on the values of the elements in all other positions of the provided sequence. |
double[] |
scoresOf(int[] tags,
int pos)
Computes the unnormalized log conditional distribution over values of the element at position pos in the sequence, conditioned on the values of the elements in all other positions of the provided sequence. |
protected java.lang.String[] |
stringTagsAt(int pos)
|
java.util.ArrayList<TaggedWord> |
tagSentence(java.util.List<? extends HasWord> s)
Tags the sentence s by running maxent model. |
protected void |
writeTagsAndErrors(java.lang.String[] finalTags,
PrintFile pf,
Dictionary wrongWords,
boolean verboseResults)
Write the tagging and note any errors (if pf != null) and accumulate global statistics. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final boolean VERBOSE
protected static final java.lang.String naTag
protected static final boolean DBG
protected static final boolean doDeterministicTagExpansion
protected static final int kBestSize
protected final java.lang.String tagSeparator
protected final java.lang.String encoding
protected final PairsHolder pairs
protected java.util.List<java.lang.String> sent
protected java.util.List<HasWord> origWords
protected int size
protected java.lang.String[] correctTags
protected java.lang.String[] finalTags
protected volatile java.util.Map<java.lang.String,double[]> localScores
protected volatile double[][] localContextScores
protected final MaxentTagger maxentTagger
Constructor Detail |
---|
public TestSentence(MaxentTagger maxentTagger)
public TestSentence(MaxentTagger maxentTagger, java.lang.String[] s, java.lang.String[] correctTags, PrintFile pf, Dictionary wrongWords, boolean verboseResults)
Method Detail |
---|
public java.util.ArrayList<TaggedWord> tagSentence(java.util.List<? extends HasWord> s)
s
- Input sentence (List). This isn't changed.
protected void revert(int prevSize)
protected void init()
protected void calculateProbs(double[][][] probabilities)
probabilities
- Array with indices sent size, k best size, numTagsprotected void writeTagsAndErrors(java.lang.String[] finalTags, PrintFile pf, Dictionary wrongWords, boolean verboseResults)
finalTags
- Chosen tags for sentencepf
- File to write tagged output to (can be null, then no output;
at present it is non-null iff the debug property is set)wrongWords
- Dictionary to accumulate wrong word counts in (cannot be null)protected void initializeScorer()
protected void cleanUpScorer()
protected java.lang.String[] append(java.lang.String[] tags, java.lang.String word)
protected double[] getHistories(java.lang.String[] tags, History h)
public int length()
length
in interface SequenceModel
public int leftWindow()
SequenceModel
leftWindow
in interface SequenceModel
public int rightWindow()
SequenceModel
rightWindow
in interface SequenceModel
public int[] getPossibleValues(int pos)
SequenceModel
getPossibleValues
in interface SequenceModel
pos
- the position
public double scoreOf(int[] tags, int pos)
SequenceModel
scoreOf
in interface SequenceModel
tags
- the sequence containing the rest of the values to condition onpos
- the position of the element to give a distribution for
public double scoreOf(int[] sequence)
SequenceModel
scoreOf
in interface SequenceModel
sequence
- the sequence to compute a score for
public double[] scoresOf(int[] tags, int pos)
SequenceModel
scoresOf
in interface SequenceModel
tags
- the sequence containing the rest of the values to condition onpos
- the position of the element to give a distribution for
protected java.lang.String[] stringTagsAt(int pos)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |