Java Code Examples for edu.cornell.cs.nlp.spf.mr.lambda.LogicalExpression#numFreeVariables()

The following examples show how to use edu.cornell.cs.nlp.spf.mr.lambda.LogicalExpression#numFreeVariables() . 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: SloppyAmrClosure.java    From amr with GNU General Public License v2.0 5 votes vote down vote up
@Deprecated
public static LogicalExpression simpleClosure(LogicalExpression semantics) {
	// TODO Remove if not using, or at least put in a different class
	final LogicalExpression closed;
	if (semantics.numFreeVariables() == 0
			&& AMRServices.isSkolemTermBody(semantics)) {
		closed = AMRServices.skolemize(semantics);
	} else {
		closed = topEntitiesClosure(semantics);
	}
	LOG.info("Simple closure: %s -> %s", semantics, closed);
	return closed;
}
 
Example 2
Source File: HasFreeVariables.java    From spf with GNU General Public License v2.0 5 votes vote down vote up
public static boolean of(LogicalExpression exp, boolean ignoreSkolemIds) {
	if (ignoreSkolemIds && exp.numFreeVariables() != 0) {
		for (final Variable variable : exp.getFreeVariables()) {
			if (!(variable instanceof SkolemId)) {
				return true;
			}
		}
		return false;
	} else {
		return exp.numFreeVariables() != 0;
	}

}
 
Example 3
Source File: ReplaceFreeVariablesIfPresent.java    From spf with GNU General Public License v2.0 5 votes vote down vote up
public static LogicalExpression of(LogicalExpression exp,
		Set<Variable> variables) {
	if (exp.numFreeVariables() == 0 || variables.isEmpty()) {
		return exp;
	}

	final ReplaceFreeVariablesIfPresent visitor = new ReplaceFreeVariablesIfPresent(
			variables);
	visitor.visit(exp);
	return visitor.getResult();
}