Examples of UnaryFormulaInfo


Examples of edu.stanford.nlp.sempre.FbFormulasInfo.UnaryFormulaInfo

    assertEquals("fb:broadcast.broadcast", bInfo.expectedType1);
    assertEquals("fb:broadcast.content", bInfo.expectedType2);
    contains = bInfo.descriptions.contains("broadcasts");
    assertEquals(true, contains);   
    //3
    UnaryFormulaInfo uInfo = infoRepos.getUnaryInfo(Formula.fromString("(fb:type.object.type fb:location.country)"));
    assertEquals(574.0, uInfo.popularity,0.0001);
    contains = uInfo.descriptions.contains("country") && uInfo.descriptions.contains("empire");
    assertEquals(true, contains);
    assertEquals("fb:location.country",uInfo.types.iterator().next());
    //4
View Full Code Here

Examples of edu.stanford.nlp.sempre.FbFormulasInfo.UnaryFormulaInfo

    if(fbFormulasInfo.getUnaryInfo(formula)==null) {
      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) {
View Full Code Here

Examples of edu.stanford.nlp.sempre.FbFormulasInfo.UnaryFormulaInfo

      Formula formula = Formula.fromString(tokens[1]);
      if(fbFormulasInfo.getUnaryInfo(formula)==null) {
          LogInfo.log("Skipping on formula since info is missing from schema: " + formula);
      }
      else {
        UnaryFormulaInfo uInfo = fbFormulasInfo.getUnaryInfo(formula);

        Map<Pair<Formula, String>, UnaryLexicalEntry> formulaToAlignmentInfoMap = res.get(nl);
        if (formulaToAlignmentInfoMap == null) {
          formulaToAlignmentInfoMap = new HashMap<Pair<Formula,String>, UnaryLexicalEntry>();
          res.put(nl, formulaToAlignmentInfoMap);
View Full Code Here

Examples of edu.stanford.nlp.sempre.FbFormulasInfo.UnaryFormulaInfo

    Set<String> subtypes = fbFormulasInfo.getSubtypesExclusive(inFgInfo.bInfo.expectedType1);
    for(String subtype: subtypes) {
      if(badDomain(subtype))
        continue;
      Formula type1Formula = new JoinFormula(FreebaseInfo.TYPE, new ValueFormula<Value>(new NameValue(subtype)));
      UnaryFormulaInfo uInfo =  fbFormulasInfo.getUnaryInfo(type1Formula);
      if(uInfo!=null) {
        for(String description: uInfo.descriptions) {
          if(validDescription(description)) {
            List<String> descriptionTokens = Arrays.asList(description.split("\\s+"));
            IntPair unarySpan = getUnarySpan(lInfo); //where should we match the description
View Full Code Here

Examples of edu.stanford.nlp.sempre.FbFormulasInfo.UnaryFormulaInfo

    Map<Formula,FbFormulasInfo.UnaryFormulaInfo> res = new HashMap<Formula, FbFormulasInfo.UnaryFormulaInfo>();
    //professions
    for(String profession: professionPopularityMap.keySet()) {
      Formula f  = new JoinFormula(PROF, new ValueFormula<Value>(new NameValue(profession)));
      UnaryFormulaInfo info = new UnaryFormulaInfo(f, professionPopularityMap.get(profession),
          MapUtils.get(professionDescriptionsMap,profession,new LinkedList<String>()),
          Collections.singleton(PERSON));
      if(!info.isComplete()) {
        continue;
      }
      res.put(f, info);
    }
    //types
    for(String type: typePopularityMap.keySet()) {
      Formula f  = new JoinFormula(TYPE, new ValueFormula<Value>(new NameValue(type)));
      UnaryFormulaInfo info = new UnaryFormulaInfo(f, typePopularityMap.get(type),
          MapUtils.get(typeDescriptionsMap,type,new LinkedList<String>()),
          Collections.singleton(type));
      if(!info.isComplete()) {
        continue;
      }
      res.put(f, info);
    }
    return res;
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.