edu.stanford.nlp.tagger.maxent
Class TestSentence

java.lang.Object
  |
  +--edu.stanford.nlp.tagger.maxent.TestSentence
All Implemented Interfaces:
edu.stanford.nlp.tagger.maxent.TagScorer

public class TestSentence
extends Object
implements edu.stanford.nlp.tagger.maxent.TagScorer


Field Summary
static int[] hPos
           
static boolean[] isTag
           
 int mikeKnown
           
 int numRight
           
 int numWrong
           
static LambdaSolve prob
           
 
Constructor Summary
TestSentence()
           
TestSentence(LambdaSolve prob, String s)
           
TestSentence(LambdaSolve prob, String[] s, String[] correctTags, PrintFile pf, Dictionary wrongWords)
           
TestSentence(LambdaSolve prob, String[] s, String[] tags, String[] correctTags, PrintFile pf, Dictionary wrongWords)
           
TestSentence(LambdaSolve prob, String s, boolean one)
           
TestSentence(LambdaSolve prob, String s, PrintFile pf)
           
 
Method Summary
 void addUnknown(Dictionary uDict)
          This method should be called after the sentence has been tagged.
 String[] append(String[] tags)
           
 double[] getHistories(History h)
           
 double[][][] getProbs()
           
 double[] getScores(History h)
          this scores the current assignment in PairsHolder current position h.current
 String getTaggedNice()
           
 void init()
           
 void init1()
           
static int[] intersect(int[] arr1, int[] arr2)
           
 boolean known(String w)
           
 int leftWindow()
           
 int length()
          Implementation of the TagScorer interface follows
static void main(String[] args)
          Tags a test sentence.
 void printProbs()
           
 void printTop(PrintFile pfu)
          This method should be called after the sentence has been tagged.
 void printUnknown(int numSent, PrintFile pfu)
          This method should be called after the sentence has been tagged.
 boolean reliable(int current)
           
 void revert(int prevSize, int afterSize)
           
 int rightWindow()
           
 double scoreOf(int[] tags, int pos)
           
 double[] scoresOf(int[] tags, int pos)
           
 String[] stringTagsAt(int pos)
           
 int[] tagsAt(int pos)
           
 Sentence tagSentence(LambdaSolve prob, Sentence s)
           
static void tagSentenceTagScorer(String[] sent)
          tag a sentence using dan's TagScorer interface
 String[] test(String outFile)
           
 void test1(PrintFile pf, Dictionary wrongWords)
           
 void testTagInference(PrintFile pf, Dictionary wrongWords)
          test using TagInference
static String toNice(String s)
           
static String toSt(String s, boolean isWord)
           
static int[] unite(int[] arr1, int[] arr2)
           
 void writeProbs()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prob

public static LambdaSolve prob

hPos

public static int[] hPos

isTag

public static boolean[] isTag

numRight

public int numRight

numWrong

public int numWrong

mikeKnown

public int mikeKnown
Constructor Detail

TestSentence

public TestSentence()

TestSentence

public TestSentence(LambdaSolve prob,
                    String s,
                    PrintFile pf)

TestSentence

public TestSentence(LambdaSolve prob,
                    String s,
                    boolean one)

TestSentence

public TestSentence(LambdaSolve prob,
                    String s)

TestSentence

public TestSentence(LambdaSolve prob,
                    String[] s,
                    String[] correctTags,
                    PrintFile pf,
                    Dictionary wrongWords)

TestSentence

public TestSentence(LambdaSolve prob,
                    String[] s,
                    String[] tags,
                    String[] correctTags,
                    PrintFile pf,
                    Dictionary wrongWords)
Method Detail

tagSentence

public Sentence tagSentence(LambdaSolve prob,
                            Sentence s)

revert

public void revert(int prevSize,
                   int afterSize)

init

public void init()

getTaggedNice

public String getTaggedNice()

toNice

public static String toNice(String s)

tagSentenceTagScorer

public static void tagSentenceTagScorer(String[] sent)
tag a sentence using dan's TagScorer interface


init1

public void init1()

writeProbs

public void writeProbs()

toSt

public static String toSt(String s,
                          boolean isWord)

test

public String[] test(String outFile)

test1

public void test1(PrintFile pf,
                  Dictionary wrongWords)

testTagInference

public void testTagInference(PrintFile pf,
                             Dictionary wrongWords)
test using TagInference


known

public boolean known(String w)

reliable

public boolean reliable(int current)

append

public String[] append(String[] tags)

getScores

public double[] getScores(History h)
this scores the current assignment in PairsHolder current position h.current


getHistories

public double[] getHistories(History h)

intersect

public static int[] intersect(int[] arr1,
                              int[] arr2)

unite

public static int[] unite(int[] arr1,
                          int[] arr2)

getProbs

public double[][][] getProbs()

printProbs

public void printProbs()

addUnknown

public void addUnknown(Dictionary uDict)
This method should be called after the sentence has been tagged. For every unknown word, this method adds the 3 most probable tags to the dictionary uDict


printUnknown

public void printUnknown(int numSent,
                         PrintFile pfu)
This method should be called after the sentence has been tagged. For every unknown word, this method prints the 3 most probable tags to the file pfu


printTop

public void printTop(PrintFile pfu)
This method should be called after the sentence has been tagged. For every word token, this method prints the 3 most probable tags to the file pfu except for


length

public int length()
Implementation of the TagScorer interface follows

Specified by:
length in interface edu.stanford.nlp.tagger.maxent.TagScorer

leftWindow

public int leftWindow()
Specified by:
leftWindow in interface edu.stanford.nlp.tagger.maxent.TagScorer

rightWindow

public int rightWindow()
Specified by:
rightWindow in interface edu.stanford.nlp.tagger.maxent.TagScorer

tagsAt

public int[] tagsAt(int pos)
Specified by:
tagsAt in interface edu.stanford.nlp.tagger.maxent.TagScorer

stringTagsAt

public String[] stringTagsAt(int pos)

scoreOf

public double scoreOf(int[] tags,
                      int pos)

scoresOf

public double[] scoresOf(int[] tags,
                         int pos)
Specified by:
scoresOf in interface edu.stanford.nlp.tagger.maxent.TagScorer

main

public static void main(String[] args)
Tags a test sentence.

Parameters:
args - A single argument giving the filename of the parameter files. This should be a complete filename for holder file, for example, ~/mine/wsj0-20.holder, but the program will also use other files by adding a second extension onto this filename. If none is provided, a default tagger in /u/nlp/data is used.


Stanford NLP Group