edu.stanford.nlp.parser.lexparser
Class RerankingParserQuery

java.lang.Object
  extended by edu.stanford.nlp.parser.lexparser.RerankingParserQuery
All Implemented Interfaces:
ParserQuery

public class RerankingParserQuery
extends java.lang.Object
implements ParserQuery

Rerank trees from the ParserQuery based on scores from a Reranker.
TODO: should handle Factored parsers as well

Author:
John Bauer

Constructor Summary
RerankingParserQuery(Options op, ParserQuery parserQuery, Reranker reranker)
           
 
Method Summary
 Tree getBestDependencyParse(boolean debinarize)
           
 Tree getBestFactoredParse()
           
 Tree getBestParse()
           
 Tree getBestPCFGParse()
           
 java.util.List<ScoredObject<Tree>> getBestPCFGParses()
           
 KBestViterbiParser getDependencyParser()
           
 KBestViterbiParser getFactoredParser()
           
 java.util.List<ScoredObject<Tree>> getKBestPCFGParses(int kbestPCFG)
           
 java.util.List<ScoredObject<Tree>> getKGoodFactoredParses(int kbest)
           
 KBestViterbiParser getPCFGParser()
           
 double getPCFGScore()
           
 boolean hasFactoredParse()
           
 java.util.List<? extends HasWord> originalSentence()
           
 boolean parse(java.util.List<? extends HasWord> sentence)
           
 boolean parseAndReport(java.util.List<? extends HasWord> sentence, java.io.PrintWriter pwErr)
           
 boolean parseFallback()
          The model had to fall back to a simpler model on the previous parse
 boolean parseNoMemory()
          The model ran out of memory on the most recent parse
 boolean parseSkipped()
          The sentence was skipped, probably because it was too long or of length 0
 boolean parseSucceeded()
          Parsing succeeded without any horrible errors or fallback
 boolean parseUnparsable()
          The model could not parse the most recent sentence for some reason
 void restoreOriginalWords(Tree tree)
           
 boolean saidMemMessage()
           
 void setConstraints(java.util.List<ParserConstraint> constraints)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RerankingParserQuery

public RerankingParserQuery(Options op,
                            ParserQuery parserQuery,
                            Reranker reranker)
Method Detail

saidMemMessage

public boolean saidMemMessage()
Specified by:
saidMemMessage in interface ParserQuery

setConstraints

public void setConstraints(java.util.List<ParserConstraint> constraints)
Specified by:
setConstraints in interface ParserQuery

parse

public boolean parse(java.util.List<? extends HasWord> sentence)
Specified by:
parse in interface ParserQuery

parseAndReport

public boolean parseAndReport(java.util.List<? extends HasWord> sentence,
                              java.io.PrintWriter pwErr)
Specified by:
parseAndReport in interface ParserQuery

getBestParse

public Tree getBestParse()
Specified by:
getBestParse in interface ParserQuery

getBestPCFGParse

public Tree getBestPCFGParse()
Specified by:
getBestPCFGParse in interface ParserQuery

getPCFGScore

public double getPCFGScore()
Specified by:
getPCFGScore in interface ParserQuery

getBestDependencyParse

public Tree getBestDependencyParse(boolean debinarize)
Specified by:
getBestDependencyParse in interface ParserQuery

getBestFactoredParse

public Tree getBestFactoredParse()
Specified by:
getBestFactoredParse in interface ParserQuery

getBestPCFGParses

public java.util.List<ScoredObject<Tree>> getBestPCFGParses()
Specified by:
getBestPCFGParses in interface ParserQuery

restoreOriginalWords

public void restoreOriginalWords(Tree tree)
Specified by:
restoreOriginalWords in interface ParserQuery

hasFactoredParse

public boolean hasFactoredParse()
Specified by:
hasFactoredParse in interface ParserQuery

getKBestPCFGParses

public java.util.List<ScoredObject<Tree>> getKBestPCFGParses(int kbestPCFG)
Specified by:
getKBestPCFGParses in interface ParserQuery

getKGoodFactoredParses

public java.util.List<ScoredObject<Tree>> getKGoodFactoredParses(int kbest)
Specified by:
getKGoodFactoredParses in interface ParserQuery

getPCFGParser

public KBestViterbiParser getPCFGParser()
Specified by:
getPCFGParser in interface ParserQuery

getFactoredParser

public KBestViterbiParser getFactoredParser()
Specified by:
getFactoredParser in interface ParserQuery

getDependencyParser

public KBestViterbiParser getDependencyParser()
Specified by:
getDependencyParser in interface ParserQuery

parseSucceeded

public boolean parseSucceeded()
Parsing succeeded without any horrible errors or fallback

Specified by:
parseSucceeded in interface ParserQuery

parseSkipped

public boolean parseSkipped()
The sentence was skipped, probably because it was too long or of length 0

Specified by:
parseSkipped in interface ParserQuery

parseFallback

public boolean parseFallback()
The model had to fall back to a simpler model on the previous parse

Specified by:
parseFallback in interface ParserQuery

parseNoMemory

public boolean parseNoMemory()
The model ran out of memory on the most recent parse

Specified by:
parseNoMemory in interface ParserQuery

parseUnparsable

public boolean parseUnparsable()
The model could not parse the most recent sentence for some reason

Specified by:
parseUnparsable in interface ParserQuery

originalSentence

public java.util.List<? extends HasWord> originalSentence()
Specified by:
originalSentence in interface ParserQuery


Stanford NLP Group