Exemplo n.º 1
0
 private List<ParseResult> removeRepeats(List<ParseResult> all) {
   System.out.println("----------------------- all.size equals to --------------" + all.size());
   List<ParseResult> bestList = new LinkedList<ParseResult>();
   for (int i = 0; i < all.size(); i++) {
     ParseResult e_i = all.get(i);
     boolean best = true;
     for (int j = i + 1; j < all.size(); j++) {
       ParseResult e_j = all.get(j);
       if (e_i.getExp().equals(e_j.getExp()) && e_i.getScore() <= e_j.getScore()) {
         best = false;
         break;
       }
     }
     if (best) bestList.add(e_i);
   }
   return bestList;
 }
Exemplo n.º 2
0
 public ParseResult bestParse(Exp sem) {
   List<ParseResult> result = findBestParses(allParses, sem);
   if (result.size() > 0) return result.get(0);
   return null;
 }
Exemplo n.º 3
0
 /**
  * Expands the lexicon and updates the weight vector and feature indices. Does not add entries
  * that are already present.
  */
 public void addLexEntries(List lex) {
   for (int i = 0; i < lex.size(); i++) {
     addLexEntry((LexEntry) lex.get(i));
   }
 }