當前位置: 首頁>>代碼示例>>Java>>正文


Java ApplyAndSimplify類代碼示例

本文整理匯總了Java中edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify的典型用法代碼示例。如果您正苦於以下問題:Java ApplyAndSimplify類的具體用法?Java ApplyAndSimplify怎麽用?Java ApplyAndSimplify使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ApplyAndSimplify類屬於edu.cornell.cs.nlp.spf.mr.lambda.visitor包,在下文中一共展示了ApplyAndSimplify類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: test16

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test16() {
	final LogicalExpression result = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $0:e (c_ARGX:<e,<e,t>> $0 (a:<id,<<e,t>,e>> na:id (lambda $1:e (and:<t*,t> (oppose-01:<e,t> $1) (c_ARGX:<e,<e,t>> $1 (a:<id,<<e,t>,e>> na:id (lambda $2:e (terrorism:<e,t> $2)))))))))");
	final LogicalExpression arg = TestServices.getCategoryServices()
			.readSemantics("(lambda $0:e (terrorism:<e,t> $0))");
	final LogicalExpression func = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $4:<e,t> (lambda $0:e (c_ARGX:<e,<e,t>> $0 (a:<id,<<e,t>,e>> na:id (lambda $1:e (and:<t*,t> (oppose-01:<e,t> $1) (c_ARGX:<e,<e,t>> $1 (a:<id,<<e,t>,e>> na:id $4))))))))");
	Assert.assertEquals(result, ApplyAndSimplify.of(func, arg));
	Assert.assertEquals(func, GetApplicationFunction.of(result, arg, 3));
	Assert.assertEquals(null, GetApplicationFunction.of(result, arg, 3, 1));
	Assert.assertEquals(null, GetApplicationFunction.of(result, arg, 3, 2));
	Assert.assertEquals(null, GetApplicationFunction.of(result, arg, 3, 3));
	Assert.assertEquals(null, GetApplicationFunction.of(result, arg, 3, 4));
	Assert.assertEquals(null, GetApplicationFunction.of(result, arg, 3, 5));
	Assert.assertEquals(null, GetApplicationFunction.of(result, arg, 3, 6));
	Assert.assertEquals(null, GetApplicationFunction.of(result, arg, 3, 7));
	Assert.assertEquals(null, GetApplicationFunction.of(result, arg, 3, 8));
	Assert.assertEquals(func, GetApplicationFunction.of(result, arg, 3, 9));
	Assert.assertEquals(func, GetApplicationFunction.of(result, arg, 3, 10));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:26,代碼來源:GetApplicationFunctionTest.java

示例2: test17

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test17() {
	final LogicalExpression result = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $0:e (and:<t*,t> (become-01:<e,t> $0) "
							+ "(c_ARGX:<e,<e,t>> $0 (a:<id,<<e,t>,e>> na:id (lambda $1:e (and:<t*,t> (warfare:<e,t> $1) (c_REL:<e,<e,t>> $1 (a:<id,<<e,t>,e>> na:id (lambda $2:e (cyber:<e,t> $2)))))))) "
							+ "(c_ARGX:<e,<e,t>> $0 (a:<id,<<e,t>,e>> na:id (lambda $3:e (and:<t*,t> (weapon:<e,t> $3) (c_REL:<e,<e,t>> $3 (a:<id,<<e,t>,e>> na:id (lambda $4:e (common:<e,t> $4)))))))) "
							+ "(c_REL:<e,<e,t>> $0 (a:<id,<<e,t>,e>> na:id (lambda $5:e (and:<t*,t> (person:<e,t> $5) (c_REL:<e,<e,t>> $5 (a:<id,<<e,t>,e>> na:id (lambda $6:e (and:<t*,t> (country:<e,t> $6) (c_REL:<e,<e,t>> $6 (a:<id,<<e,t>,e>> na:id (lambda $7:e (and:<t*,t> (name:<e,t> $7) (c_op:<e,<e,t>> $7 South++Korea:e)))))))))))))))");
	final LogicalExpression arg = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $0:e (and:<t*,t> (become-01:<e,t> $0) "
							+ "(c_ARGX:<e,<e,t>> $0 (a:<id,<<e,t>,e>> na:id (lambda $1:e (and:<t*,t> (warfare:<e,t> $1) (c_REL:<e,<e,t>> $1 (a:<id,<<e,t>,e>> na:id (lambda $2:e (cyber:<e,t> $2)))))))) "
							+ "(c_ARGX:<e,<e,t>> $0 (a:<id,<<e,t>,e>> na:id (lambda $3:e (and:<t*,t> (c_REL:<e,<e,t>> $3 (a:<id,<<e,t>,e>> na:id (lambda $4:e (common:<e,t> $4)))) (weapon:<e,t> $3)))))))");
	final LogicalExpression func = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $1:<e,t> (lambda $0:e (and:<t*,t>  "
							+ "($1 $0) "
							+ "(c_REL:<e,<e,t>> $0 (a:<id,<<e,t>,e>> na:id (lambda $5:e (and:<t*,t> (person:<e,t> $5) "
							+ "(c_REL:<e,<e,t>> $5 (a:<id,<<e,t>,e>> na:id (lambda $6:e (and:<t*,t> (country:<e,t> $6) (c_REL:<e,<e,t>> $6 (a:<id,<<e,t>,e>> na:id (lambda $7:e (and:<t*,t> (name:<e,t> $7) (c_op:<e,<e,t>> $7 South++Korea:e))))))))))))))))");
	Assert.assertEquals(result, ApplyAndSimplify.of(func, arg));
	Assert.assertEquals(func, GetApplicationFunction.of(result, arg, 3));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:26,代碼來源:GetApplicationFunctionTest.java

示例3: test9

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test9() {
	final LogicalExpression result = TestServices
			.getCategoryServices()
			.readSemantics(
					"(a:<id,<<e,t>,e>> na:id (lambda $0:e (and:<t*,t> "
							+ "(and:<e,t> $0) "
							+ "(c_op1:<e,<e,t>> $0 (a:<id,<<e,t>,e>> na:id (lambda $1:e (international:<e,t> $1)))) "
							+ "(c_op2:<e,<e,t>> $0 (a:<id,<<e,t>,e>> na:id (lambda $2:e (military:<e,t> $2)))) "
							+ "(c_op2:<e,<e,t>> $0 (a:<id,<<e,t>,e>> na:id (lambda $3:e (terrorism:<e,t> $3)))))))");
	final LogicalExpression arg = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $0:<e,<e,t>> (lambda $1:e (lambda $2:e ($0 $1 $2))))");
	Assert.assertEquals(result, ApplyAndSimplify.of(
			GetApplicationFunction.of(result, arg, 3), arg));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:18,代碼來源:GetApplicationFunctionTest.java

示例4: apply

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Override
public LogicalExpression apply(LogicalExpression function,
		LogicalExpression argument) {
	final LogicalExpression result;

	// Combined application and simplification
	final LogicalExpression applicationResult = ApplyAndSimplify.of(
			function, argument);
	// Verify application result is well typed, only if verification is
	// turned on
	if (applicationResult != null && doTypeChecking
			&& !IsTypeConsistent.of(applicationResult)) {
		result = null;
	} else {
		result = applicationResult;
	}

	return result;
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:20,代碼來源:LogicalExpressionCategoryServices.java

示例5: bindOperation

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
private static LogicalExpression bindOperation(
    LogicalExpression leftTreeParse, LogicalExpression rightTreeParse) {
  Preconditions.checkNotNull(leftTreeParse);
  Preconditions.checkNotNull(rightTreeParse);
  Preconditions.checkArgument(rightTreeParse instanceof LogicalConstant);

  // Dirty implementation. A better way is to work with objects and not the
  // strings.
  Type leftType = leftTreeParse.getType();
  String existsExpression =
      String.format("(lambda $f:%s (exists:<%s,<%s,%s>> $x:%s ($f $x))",
          leftType, leftType.getDomain(), leftType.getRange(),
          leftType.getRange(), leftType.getDomain());
  leftTreeParse =
      ApplyAndSimplify
          .of(SimpleLogicalExpressionReader.read(existsExpression),
              leftTreeParse);

  String variable = rightTreeParse.toString();
  String leftParse = leftTreeParse.toString();
  String variableType = rightTreeParse.getType().getDomain().toString();
  String returnType = rightTreeParse.getType().getRange().toString();
  Pattern variablePattern =
      Pattern.compile(String.format("([\\(\\)\\s])(%s)([\\(\\)\\s])",
          variable));
  Matcher matcher = variablePattern.matcher(leftParse);

  String finalString =
      matcher
          .replaceAll(String.format("$1%s:<%s,<%s,%s>> \\$x$3",
              PredicateKeys.EQUAL_PREFIX, variableType, variableType,
              returnType));
  finalString = String.format("(lambda $x:%s %s)", variableType, finalString);
  return SimpleLogicalExpressionReader.read(finalString);
}
 
開發者ID:sivareddyg,項目名稱:UDepLambda,代碼行數:36,代碼來源:TreeTransformer.java

示例6: test12

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test12() {
	final LogicalExpression result = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $0:e (lambda $1:<e,t> (a:<id,<<e,t>,e>> na:id (lambda $2:e (and:<t*,t>\n"
							+ "	($1 $2)\n"
							+ "	(c_ARGX:<e,<e,t>> $2 (a:<id,<<e,t>,e>> na:id (lambda $3:e (and:<t*,t>\n"
							+ "		(and:<e,t> $3)\n"
							+ "		(c_op1:<e,<e,t>> $3 (a:<id,<<e,t>,e>> na:id (lambda $4:e (and:<t*,t>\n"
							+ "			(bias-01:<e,t> $4)\n"
							+ "			(c_ARGX:<e,<e,t>> $4 $0)\n"
							+ "			(c_REL:<e,<e,t>> $4 \n"
							+ "				(a:<id,<<e,t>,e>> na:id (lambda $5:e (cultural:<e,t> $5))))))))\n"
							+ "		(c_op2:<e,<e,t>> $3 (a:<id,<<e,t>,e>> na:id (lambda $6:e (and:<t*,t>\n"
							+ "			(insult-01:<e,t> $6)\n"
							+ "			(c_ARGX:<e,<e,t>> $6 $0)\n"
							+ "			(c_ARGX:<e,<e,t>> $6 $0))))))))))))))");
	final LogicalExpression arg = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $0:e (lambda $1:e (lambda $2:e (c_ARGX:<e,<e,t>> $2 (a:<id,<<e,t>,e>> na:id (lambda $3:e (and:<t*,t>\n"
							+ "	(c_op1:<e,<e,t>> $3 $1)\n"
							+ "	(c_op2:<e,<e,t>> $3 $0)\n"
							+ "	(and:<e,t> $3))))))))");
	Assert.assertEquals(result, ApplyAndSimplify.of(
			GetApplicationFunction.of(result, arg, 3), arg));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:29,代碼來源:GetApplicationFunctionTest.java

示例7: test13

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test13() {
	final LogicalExpression result = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $0:e (lambda $1:e (and:<t*,t> (propose-01:<e,t> $1) (c_ARGX:<e,<e,t>> $1 $0))))");
	final LogicalExpression arg = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $0:<e,<e,t>> (lambda $1:e (lambda $2:e ($0 $1 $2))))");
	Assert.assertEquals(result, ApplyAndSimplify.of(
			GetApplicationFunction.of(result, arg, 3), arg));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:14,代碼來源:GetApplicationFunctionTest.java

示例8: test14

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test14() {
	final LogicalExpression result = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $4:e (c_ARGX:<e,<e,t>> $4\n"
							+ "                (a:<id,<<e,t>,e>> na:id (lambda $5:e (and:<t*,t>\n"
							+ "                  (oppose-01:<e,t> $5)\n"
							+ "                  (c_ARGX:<e,<e,t>> $5\n"
							+ "                    (a:<id,<<e,t>,e>> na:id (lambda $6:e (terrorism:<e,t> $6)))))))))");
	final LogicalExpression arg = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $0:e (c_ARGX:<e,<e,t>> $0 (a:<id,<<e,t>,e>> na:id (lambda $1:e (terrorism:<e,t> $1)))))");
	final LogicalExpression func = TestServices
			.getCategoryServices()
			.readSemantics(
					"(lambda $0:<e,t> (lambda $4:e (c_ARGX:<e,<e,t>> $4\n"
							+ "                (a:<id,<<e,t>,e>> na:id (lambda $5:e (and:<t*,t>\n"
							+ "                  (oppose-01:<e,t> $5)\n"
							+ "                  ($0 $5)))))))");
	Assert.assertEquals(result, ApplyAndSimplify.of(func, arg));
	Assert.assertEquals(func, GetApplicationFunction.of(result, arg, 3));
	Assert.assertEquals(null, GetApplicationFunction.of(result, arg, 3, 1));
	Assert.assertEquals(null, GetApplicationFunction.of(result, arg, 3, 2));
	Assert.assertEquals(null, GetApplicationFunction.of(result, arg, 3, 3));
	Assert.assertEquals(null, GetApplicationFunction.of(result, arg, 3, 4));
	Assert.assertEquals(func, GetApplicationFunction.of(result, arg, 3, 5));
	Assert.assertEquals(func, GetApplicationFunction.of(result, arg, 3, 6));
	Assert.assertEquals(func, GetApplicationFunction.of(result, arg, 3, 7));
	Assert.assertEquals(func, GetApplicationFunction.of(result, arg, 3, 8));
	Assert.assertEquals(func, GetApplicationFunction.of(result, arg, 3, 9));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:34,代碼來源:GetApplicationFunctionTest.java

示例9: test1

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test1() {
	final LogicalExpression e1 = LogicalExpression
			.read("(lambda $0:<e,t> (lambda $1:e (and:<t*,t> (boo:<e,t> $1) ($0 $1))))");
	final LogicalExpression a1 = LogicalExpression.read("doo:<e,t>");
	final LogicalExpression r1 = ApplyAndSimplify.of(e1, a1);
	final LogicalExpression expected1 = LogicalExpression
			.read("(lambda $0:e (and:<t*,t> (boo:<e,t> $0) (doo:<e,t> $0)))");
	assertTrue(String.format("%s != %s", r1, expected1),
			expected1.equals(r1));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:12,代碼來源:ApplyAndSimplifyTest.java

示例10: test10

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test10() {
	final LogicalExpression e1 = LogicalExpression
			.read("(lambda $0:t (or:<t*,t> (boo:<e,t> foo:e) $0))");
	final LogicalExpression a1 = LogicalExpression
			.read("(or:<t*,t> (goo:<e,t> foo:e) (koo:<e,t> foo:e))");
	final LogicalExpression r1 = ApplyAndSimplify.of(e1, a1);
	final LogicalExpression expected1 = LogicalExpression
			.read("(or:<t*,t> (goo:<e,t> foo:e) (koo:<e,t> foo:e) (boo:<e,t> foo:e))");
	assertTrue(String.format("%s != %s", r1, expected1),
			expected1.equals(r1));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:13,代碼來源:ApplyAndSimplifyTest.java

示例11: test11

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test11() {
	final LogicalExpression e1 = LogicalExpression
			.read("(lambda $0:t (or:<t*,t> (boo:<e,t> foo:e) $0))");
	final LogicalExpression a1 = LogicalExpression
			.read("(and:<t*,t> (goo:<e,t> foo:e) (koo:<e,t> foo:e))");
	final LogicalExpression r1 = ApplyAndSimplify.of(e1, a1);
	final LogicalExpression expected1 = LogicalExpression
			.read("(or:<t*,t> (and:<t*,t> (goo:<e,t> foo:e) (koo:<e,t> foo:e)) (boo:<e,t> foo:e))");
	assertTrue(String.format("%s != %s", r1, expected1),
			expected1.equals(r1));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:13,代碼來源:ApplyAndSimplifyTest.java

示例12: test2

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test2() {
	final LogicalExpression e1 = LogicalExpression.read("goo:<<e,t>,t>");
	final LogicalExpression a1 = LogicalExpression.read("doo:<e,t>");
	final LogicalExpression r1 = ApplyAndSimplify.of(e1, a1);
	final LogicalExpression expected1 = LogicalExpression
			.read("(goo:<<e,t>,t> doo:<e,t>)");
	assertTrue(String.format("%s != %s", r1, expected1),
			expected1.equals(r1));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:11,代碼來源:ApplyAndSimplifyTest.java

示例13: test3

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test3() {
	final LogicalExpression e1 = LogicalExpression
			.read("(lambda $0:e (lambda $1:e (boo:<e,<e,t>> $0 $1)))");
	final LogicalExpression a1 = LogicalExpression.read("goo:e");
	final LogicalExpression r1 = ApplyAndSimplify.of(e1, a1);
	final LogicalExpression expected1 = LogicalExpression
			.read("(lambda $0:e (boo:<e,<e,t>> goo:e $0))");
	assertTrue(String.format("%s != %s", r1, expected1),
			expected1.equals(r1));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:12,代碼來源:ApplyAndSimplifyTest.java

示例14: test4

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test4() {
	final LogicalExpression e1 = LogicalExpression
			.read("(boo:<e,<e,t>> go:e)");
	final LogicalExpression a1 = LogicalExpression.read("bo:e");
	final LogicalExpression r1 = ApplyAndSimplify.of(e1, a1);
	final LogicalExpression expected1 = LogicalExpression
			.read("(boo:<e,<e,t>> go:e bo:e)");
	assertTrue(String.format("%s != %s", r1, expected1),
			expected1.equals(r1));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:12,代碼來源:ApplyAndSimplifyTest.java

示例15: test5

import edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify; //導入依賴的package包/類
@Test
public void test5() {
	final LogicalExpression e1 = LogicalExpression
			.read("(and:<t*,t> go:t)");
	final LogicalExpression a1 = LogicalExpression.read("do:t");
	final LogicalExpression r1 = ApplyAndSimplify.of(e1, a1);
	final LogicalExpression expected1 = LogicalExpression
			.read("(and:<t*,t> go:t do:t)");
	assertTrue(String.format("%s != %s", r1, expected1),
			expected1.equals(r1));
}
 
開發者ID:clic-lab,項目名稱:spf,代碼行數:12,代碼來源:ApplyAndSimplifyTest.java


注:本文中的edu.cornell.cs.nlp.spf.mr.lambda.visitor.ApplyAndSimplify類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。