Examples of BinaryLexicalEntry


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

  public void binary() throws IOException {
    BinaryLexicon.opts.keyToSortBy = BinaryLexicon.INTERSECTION;

    BinaryLexicon lexicon = new BinaryLexicon();
    List<BinaryLexicalEntry> entries = lexicon.lookupEntries("bear in");
    BinaryLexicalEntry top = entries.get(0);
    assertEquals("people born here", top.fbDescriptions.iterator().next());
    assertEquals("!fb:location.location.people_born_here", top.formula.toString());
    assertEquals("ALIGNMENT", top.source.toString());
    assertEquals(759773.0,top.popularity,0.00001)// Based on 93.exec (full Freebase)
    assertEquals("fb:people.person",top.expectedType1);
View Full Code Here

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

    List<BinaryLexicalEntry> binaryEntries = buildEntry(lexValue, mapKey);
    for (BinaryLexicalEntry binaryEntry : binaryEntries) {
      Pair<Formula, String> formulaLexemePair = new Pair<Formula, String>(binaryEntry.formula, binaryEntry.fullLexeme);
      if (entries.containsKey(formulaLexemePair)) {
        BinaryLexicalEntry otherEntry = entries.get(formulaLexemePair);
        if (!binaryEntry.identicalFormulaInfo(otherEntry)) {
          throw new RuntimeException("Different entries for same formula, existing entry: " + otherEntry + ", new entry: " + binaryEntry);
        }
        //hack
        if (binaryEntry.source == EntrySource.STRING_MATCH && otherEntry.source == EntrySource.STRING_MATCH)
View Full Code Here

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

    if (fbFormulasInfo.isCvtFormula(info) && source == EntrySource.STRING_MATCH) {

      List<BinaryLexicalEntry> entries = new ArrayList<LexicalEntry.BinaryLexicalEntry>();
      for (BinaryFormulaInfo cvtInfo : fbFormulasInfo.getCvtExpansions(info)) {
        entries.add(
            new BinaryLexicalEntry(
                mapKey, mapKey, new HashSet<String>(cvtInfo.descriptions), cvtInfo.formula, source,
                cvtInfo.popularity, cvtInfo.expectedType1, cvtInfo.expectedType2, cvtInfo.unitId, cvtInfo.unitDesc, alignmentScores, lexValue.lexeme));
      }
      return entries;
    } else {
      BinaryLexicalEntry entry = new BinaryLexicalEntry(
          mapKey, mapKey, new HashSet<String>(info.descriptions), lexValue.formula, source,
          info.popularity, info.expectedType1, info.expectedType2, info.unitId, info.unitDesc, alignmentScores, lexValue.lexeme);
      return Collections.singletonList(entry);
    }
  }
View Full Code Here

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

    PrintWriter writer = IOUtils.getPrintWriter(out);

    for (String lexeme : lexemeToEntryMap.keySet()) {
      Map<Pair<Formula, String>, BinaryLexicalEntry> entries = lexemeToEntryMap.get(lexeme);
      for (Pair<Formula, String> pair : entries.keySet()) {
        BinaryLexicalEntry entry = entries.get(pair);
        if (entry.jaccard() > 0.001)
          writer.println(pair.second + "\t" + entry.fbDescriptions + "\t" + entry.jaccard());
      }
    }
    writer.close();
  }
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.