예제 #1
0
 private void uploadAlignmentLexicon() {
   for (String line : IOUtils.readLines(lexiconFile)) {
     LexiconValue lv = Json.readValueHard(line, LexiconValue.class);
     double newCount = MapUtils.getDouble(lv.features, "Intersection_size_typed", 0.0);
     if (newCount > opts.alignmentLexiconThreshold) {
       if (formulaToLexemsMap.containsKey(lv.formula)) {
         double currCount = formulaToLexemsMap.get(lv.formula).getSecond();
         if (newCount > currCount) {
           formulaToLexemsMap.put(lv.formula, Pair.newPair(lv.lexeme, newCount));
         }
       } else {
         formulaToLexemsMap.put(lv.formula, Pair.newPair(lv.lexeme, newCount));
       }
     }
   }
 }
예제 #2
0
 public static void setClass2KeyMapping(File file) throws ClassNotFoundException {
   for (String line : IOUtils.readLines(file)) {
     String[] toks = line.split("###");
     class2KeyMapping.put(Class.forName(toks[0]), toks[1]);
   }
 }