/// <summary>The model had to fall back to a simpler model on the previous parse</summary> public virtual bool ParseFallback() { return(parserQuery.ParseFallback()); }
// end parseFiles public virtual void ProcessResults(IParserQuery parserQuery, int num, PrintWriter pwo) { if (parserQuery.ParseSkipped()) { IList <IHasWord> sentence = parserQuery.OriginalSentence(); if (sentence != null) { numWords -= sentence.Count; } numSkipped++; } if (parserQuery.ParseNoMemory()) { numNoMemory++; } if (parserQuery.ParseUnparsable()) { numUnparsable++; } if (parserQuery.ParseFallback()) { numFallback++; } saidMemMessage = saidMemMessage || parserQuery.SaidMemMessage(); Tree ansTree = parserQuery.GetBestParse(); if (ansTree == null) { pwo.Println("(())"); return; } if (pcfgLL != null && parserQuery.GetPCFGParser() != null) { pcfgLL.RecordScore(parserQuery.GetPCFGParser(), pwErr); } if (depLL != null && parserQuery.GetDependencyParser() != null) { depLL.RecordScore(parserQuery.GetDependencyParser(), pwErr); } if (factLL != null && parserQuery.GetFactoredParser() != null) { factLL.RecordScore(parserQuery.GetFactoredParser(), pwErr); } try { treePrint.PrintTree(ansTree, int.ToString(num), pwo); } catch (Exception re) { pwErr.Println("TreePrint.printTree skipped: out of memory (or other error)"); Sharpen.Runtime.PrintStackTrace(re, pwErr); numNoMemory++; try { treePrint.PrintTree(null, int.ToString(num), pwo); } catch (Exception e) { pwErr.Println("Sentence skipped: out of memory or error calling TreePrint."); pwo.Println("(())"); Sharpen.Runtime.PrintStackTrace(e, pwErr); } } // crude addition of k-best tree printing // TODO: interface with the RerankingParserQuery if (op.testOptions.printPCFGkBest > 0 && parserQuery.GetPCFGParser() != null && parserQuery.GetPCFGParser().HasParse()) { IList <ScoredObject <Tree> > trees = parserQuery.GetKBestPCFGParses(op.testOptions.printPCFGkBest); treePrint.PrintTrees(trees, int.ToString(num), pwo); } else { if (op.testOptions.printFactoredKGood > 0 && parserQuery.GetFactoredParser() != null && parserQuery.GetFactoredParser().HasParse()) { // DZ: debug n best trees IList <ScoredObject <Tree> > trees = parserQuery.GetKGoodFactoredParses(op.testOptions.printFactoredKGood); treePrint.PrintTrees(trees, int.ToString(num), pwo); } } }