Java Code Examples for edu.cornell.cs.nlp.spf.mr.lambda.LogicalExpression#equals()
The following examples show how to use
edu.cornell.cs.nlp.spf.mr.lambda.LogicalExpression#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AMRTestParseUtil.java From amr with GNU General Public License v2.0 | 6 votes |
public static void logParse(LogicalExpression label, IJointDerivation<LogicalExpression, LogicalExpression> derivation, boolean verbose, IDataItemModel<LogicalExpression> dataItemModel) { final boolean isGold = label != null && label.equals(derivation.getResult()); LOG.info("%s[v=%.2f] %s", isGold ? "* " : " ", derivation.getViterbiScore(), derivation); if (verbose) { for (final IWeightedParseStep<LogicalExpression> step : derivation .getMaxSteps()) { LOG.info("\t%s", step.toString(false, false, dataItemModel.getTheta())); } LOG.info("Features: %s", dataItemModel.getTheta() .printValues(derivation.getMeanMaxFeatures())); } }
Example 2
Source File: ParseUtil.java From spf with GNU General Public License v2.0 | 6 votes |
private void reportCorrectParses( List<? extends IDerivation<LogicalExpression>> correctParses, LogicalExpression label) { final Iterator<? extends IDerivation<LogicalExpression>> iterator = correctParses .iterator(); LOG.info("------------------"); while (iterator.hasNext()) { final IDerivation<LogicalExpression> parse = iterator.next(); LOG.info("Correct parse details:"); if (!label.equals(parse.getSemantics())) { LOG.info(prettyPrinter.toString(parse.getSemantics())); } LOG.info("%d parses", parse.numParses()); LOG.info("Lexical entries used in max-scoring derivations:"); for (final LexicalEntry<LogicalExpression> entry : parse .getMaxLexicalEntries()) { LOG.info(entry); } LOG.info("Rules used in max-scoring derivations: %s", ListUtils.join(parse.getMaxRulesUsed(), ", ")); if (iterator.hasNext()) { LOG.info("------------------"); } } }
Example 3
Source File: AMRServices.java From amr with GNU General Public License v2.0 | 5 votes |
public static boolean isRefPredicate(LogicalExpression exp) { if (exp instanceof LogicalConstant && ((LogicalConstant) exp) .getBaseName().equals(INSTANCE.refPredicateBaseName)) { // Get return type, create a skolem predicate for it and compare. return exp.equals(createRefPredicate(getFinalType(exp.getType()))); } return false; }
Example 4
Source File: AMRServices.java From amr with GNU General Public License v2.0 | 5 votes |
public static boolean isSkolemPredicate(LogicalExpression exp) { if (exp instanceof LogicalConstant && ((LogicalConstant) exp) .getBaseName().equals(INSTANCE.skolemPredicateBaseName)) { // Get return type, create a skolem predicate for it and compare. return exp .equals(createSkolemPredicate(getFinalType(exp.getType()))); } return false; }
Example 5
Source File: AToExists.java From spf with GNU General Public License v2.0 | 5 votes |
private LogicalExpression noUpperLevelWrapIfPossible(LogicalExpression exp, Stack<Pair<Variable, ? extends LogicalExpression>> stack) { if (stack.size() == 1 && exp.equals(stack.peek().first()) && LogicLanguageServices.getTypeRepository() .getTruthValueType() .equals(stack.peek().second().getType())) { final Pair<Variable, ? extends LogicalExpression> pop = stack.pop(); final LogicalExpression[] args = new LogicalExpression[1]; args[0] = new Lambda(pop.first(), pop.second()); return new Literal(existsPredicate, args); } else { return exp; } }
Example 6
Source File: LogicalExpressionCategoryServicesTest.java From spf with GNU General Public License v2.0 | 5 votes |
@Test public void compose1() { final LogicalExpression f = TestServices.getCategoryServices() .readSemantics("f:<<e,t>,t>"); final LogicalExpression g = TestServices.getCategoryServices() .readSemantics("g:<<e,t>,<e,t>>"); final LogicalExpression expected = TestServices.getCategoryServices() .readSemantics( "(lambda $0:<e,t> (f:<<e,t>,t> (g:<<e,t>,<e,t>> $0)))"); final LogicalExpression result = TestServices.getCategoryServices() .compose(f, g, 1); expected.equals(result); assertEquals(expected, result); }
Example 7
Source File: SingleSentence.java From spf with GNU General Public License v2.0 | 4 votes |
@Override public boolean isCorrect(LogicalExpression label) { return label.equals(semantics); }