Examples of UnaryLexicalEntry


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

    if (entries.size() <= topK)
      return; // no need to prune
    //sort by jaccard
    List<Pair<Pair<Formula, String>, Double>> formulaToScoreList = new LinkedList<Pair<Pair<Formula, String>, Double>>();
    for (Pair<Formula, String> formulaAndSource : entries.keySet()) {
      UnaryLexicalEntry uEntry = entries.get(formulaAndSource);
      double jaccard = computeJaccard(uEntry.alignmentScores);
      formulaToScoreList.add(new Pair<Pair<Formula, String>, Double>(formulaAndSource, jaccard));
    }
    Collections.sort(formulaToScoreList, new BySecondReversePairComparator<Pair<Formula, String>, Double>());
View Full Code Here

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

      if(opts.verbose>=3)
        LogInfo.log("Missing info for unary: " + formula);
    }
    else {
      UnaryFormulaInfo uInfo = fbFormulasInfo.getUnaryInfo(formula);
      UnaryLexicalEntry uEntry = new UnaryLexicalEntry(nl, nl,  new TreeSet<String>(uInfo.descriptions), formula, EntrySource.parseSourceDesc(source),
          uInfo.popularity, new TreeMap<String,Double>(featureMap), uInfo.types);
     
      Map<Pair<Formula, String>, UnaryLexicalEntry> formulaToAlignmentInfoMap = nlToFormulaAndAlignmentMap.get(nl);
      if (formulaToAlignmentInfoMap == null) {
        formulaToAlignmentInfoMap = new HashMap<Pair<Formula,String>, UnaryLexicalEntry>();
View Full Code Here

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

        Map<Pair<Formula, String>, UnaryLexicalEntry> formulaToAlignmentInfoMap = res.get(nl);
        if (formulaToAlignmentInfoMap == null) {
          formulaToAlignmentInfoMap = new HashMap<Pair<Formula,String>, UnaryLexicalEntry>();
          res.put(nl, formulaToAlignmentInfoMap);
        }
        UnaryLexicalEntry uEntry =
            formulaToAlignmentInfoMap.get(new Pair<Formula,String>(formula,EntrySource.STRING_MATCH.toString()));
        if (uEntry == null) {
         
          uEntry = new UnaryLexicalEntry(nl, nl, new TreeSet<String>(uInfo.descriptions), formula, EntrySource.STRING_MATCH, uInfo.popularity,
              new TreeMap<String,Double>(), uInfo.types);
          formulaToAlignmentInfoMap.put(new Pair<Formula, String>(formula, EntrySource.STRING_MATCH.toString()), uEntry);
        }
        i++;
        if (i % 1000 == 0)
View Full Code Here

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

  public void saveUnaryLexiconFile(String outFile) throws IOException {

    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

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

    String normalizedTextDesc = textDesc.toLowerCase();
    Map<Pair<Formula, String>, UnaryLexicalEntry> entries = lexemeToEntryMap.get(normalizedTextDesc);

    if (entries != null) {
      for (Pair<Formula, String> formulaAndSource : entries.keySet()) {       
        UnaryLexicalEntry uEntry = entries.get(formulaAndSource);
        if (valid(uEntry))
          res.add(uEntry);
      }
      Collections.sort(res, new UnaryLexicalEntryComparator());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.