コード例 #1
0
ファイル: FbFormulasInfo.java プロジェクト: heshizhu/sempre
 private boolean isLegalCvt(Formula inner, Formula outer) {
   if (FreebaseInfo.isReverseProperty(inner.toString())
       && !FreebaseInfo.isReverseProperty(outer.toString())) return false;
   if (!FreebaseInfo.isReverseProperty(inner.toString())
       && FreebaseInfo.isReverseProperty(outer.toString())) return false;
   // if (isEquivalent(reverseFormula(outer), inner)) //don't expand if reverse is equivalent
   // return false;
   return true;
 }
コード例 #2
0
ファイル: QuestionGenerator.java プロジェクト: kurige/sempre
 private String getType1Desc(FormulaGenerationInfo fgInfo) {
   if (fgInfo.isUnary) {
     return fgInfo.uInfo.getRepresentativeDescrption();
   }
   if (fgInfo.bInfo.expectedType1.equals(FreebaseInfo.DATE)) return "date";
   if (fgInfo.bInfo.expectedType1.equals(FreebaseInfo.FLOAT)) return "number";
   if (fgInfo.bInfo.expectedType1.equals(FreebaseInfo.INT)) return "number";
   if (fgInfo.bInfo.expectedType1.equals(FreebaseInfo.BOOLEAN)) return "";
   if (fgInfo.bInfo.expectedType1.equals(FreebaseInfo.TEXT)) return "description";
   Formula type1Formula =
       new JoinFormula(
           FreebaseInfo.TYPE, new ValueFormula<Value>(new NameValue(fgInfo.bInfo.expectedType1)));
   try {
     if (fbFormulasInfo.getUnaryInfo(type1Formula) == null) {
       LogInfo.logs("No unary info for=%s", type1Formula);
       return null;
     }
     return fbFormulasInfo.getUnaryInfo(type1Formula).getRepresentativeDescrption();
   } catch (NullPointerException e) {
     if (type1Formula.toString().equals("(fb:type.object.type fb:type.object)")) return "thing";
     else {
       LogInfo.logs(
           "Binfo exType1=%s, exType2=%s", fgInfo.bInfo.expectedType1, fgInfo.bInfo.expectedType2);
       throw new RuntimeException(e);
     }
   }
 }
コード例 #3
0
ファイル: FbFormulasInfo.java プロジェクト: heshizhu/sempre
 public String toString() {
   return formula.toString()
       + "\t"
       + popularity
       + "\t"
       + expectedType1
       + "\t"
       + expectedType2
       + "\t"
       + unitId
       + "\t"
       + unitDesc
       + "\t"
       + Joiner.on("###").join(descriptions);
 }