Package edu.stanford.nlp.sempre.fbalignment.lexicons.LexicalEntry

Examples of edu.stanford.nlp.sempre.fbalignment.lexicons.LexicalEntry.LexiconValue


    LogInfo.end_track();
  }

  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) {
View Full Code Here


  private static void loadLexiconFileIntoMap(String lexiconFileName,
      Map<String, Map<Pair<Formula, String>, UnaryLexicalEntry>> nlToFormulaAndAlignmentMap) {
    LogInfo.begin_track("Loading lexicon file " + lexiconFileName);

    for (String line : IOUtils.readLines(lexiconFileName)) {
      LexiconValue lv = Json.readValueHard(line, LexiconValue.class);
      addEntry(lv.lexeme, lv.source, lv.formula, lv.features, nlToFormulaAndAlignmentMap);
    }
    LogInfo.log("Number of entries: " + nlToFormulaAndAlignmentMap.size());
    LogInfo.end_track();
  }
View Full Code Here

    PrintWriter writer = IOUtils.getPrintWriter(outFile);
    for (String nl : lexemeToEntryMap.keySet()) {
      for (Pair<Formula, String> formulaAndSource : lexemeToEntryMap.get(nl).keySet()) {
        UnaryLexicalEntry uEntry = lexemeToEntryMap.get(nl).get(formulaAndSource);
        LexiconValue lv = new LexiconValue(nl, formulaAndSource.first(), formulaAndSource.second(), uEntry.alignmentScores);
        writer.println(Json.writeValueAsStringHard(lv));
      }
    }
    writer.close();
  }
View Full Code Here

  private void uploadFile(String lexiconFile) throws IOException {

    LogInfo.begin_track_printAll("Loading lexicon file " + lexiconFile);
    for (String line : IOUtils.readLines(lexiconFile)) {
    
      LexiconValue lv = Json.readValueHard(line, LexiconValue.class);
      String lexemeKey = lv.lexeme;
      String normalizedLexemeKey = lexiconLoadingNormalizer.normalize(lexemeKey);
      addEntryToMap(lexemeToEntryMap, lexemeKey, lv);
      if (!lexemeKey.equals(normalizedLexemeKey)) {
        addEntryToMap(lexemeToEntryMap, normalizedLexemeKey, lv);
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.sempre.fbalignment.lexicons.LexicalEntry.LexiconValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.