Ejemplo n.º 1
0
 /** @param stateSetTree */
 public static void printBadLLReason(Tree<StateSet> stateSetTree, SophisticatedLexicon lexicon) {
   System.out.println(stateSetTree.toString());
   boolean lexiconProblem = false;
   List<StateSet> words = stateSetTree.getYield();
   Iterator<StateSet> wordIterator = words.iterator();
   for (StateSet stateSet : stateSetTree.getPreTerminalYield()) {
     String word = wordIterator.next().getWord();
     boolean lexiconProblemHere = true;
     for (int i = 0; i < stateSet.numSubStates(); i++) {
       double score = stateSet.getIScore(i);
       if (!(Double.isInfinite(score) || Double.isNaN(score))) {
         lexiconProblemHere = false;
       }
     }
     if (lexiconProblemHere) {
       System.out.println("LEXICON PROBLEM ON STATE " + stateSet.getState() + " word " + word);
       System.out.println("  word " + lexicon.wordCounter.getCount(stateSet.getWord()));
       for (int i = 0; i < stateSet.numSubStates(); i++) {
         System.out.println("  tag " + lexicon.tagCounter[stateSet.getState()][i]);
         System.out.println(
             "  word/state/sub "
                 + lexicon.wordToTagCounters[stateSet.getState()].get(stateSet.getWord())[i]);
       }
     }
     lexiconProblem = lexiconProblem || lexiconProblemHere;
   }
   if (lexiconProblem) System.out.println("  the likelihood is bad because of the lexicon");
   else System.out.println("  the likelihood is bad because of the grammar");
 }