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

The following examples show how to use edu.cornell.cs.nlp.spf.mr.lambda.LogicalExpression#accept() . 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: SingleSentencePartialCreditTestingStatistics.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 2
Source File: GetAllLiterals.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 3
Source File: AttachmentFeatures.java    From amr with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 4
Source File: GetParameterVariablesList.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 5
Source File: IsContainingVariable.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 6
Source File: AbstractAmrParser.java    From amr with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 7
Source File: LexConstants.java    From amr with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 8
Source File: LogicalExpressionToLatexString.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 9
Source File: ExtractTypedSubExpression.java    From amr with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 10
Source File: CreateFactorGraph.java    From amr with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 11
Source File: IsTypeConsistent.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 12
Source File: LogicalExpressionToString.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 13
Source File: FactoringServices.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 14
Source File: GetVariables.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 15
Source File: MakeCompositionSplits.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 16
Source File: AMRSupervisedFilter.java    From amr with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 17
Source File: GetApplicationFunction.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 18
Source File: AToExists.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(Literal literal) {
	final int len = literal.numArgs();
	if (aPredicate.equals(literal.getPredicate())) {
		if (len == 1) {
			final Lambda innerLambda = makeEntityToTruthLambda(literal
					.getArg(0));
			if (innerLambda == null) {
				throw new IllegalStateException("Invalid A expression: "
						+ literal);
			}
			innerLambda.getBody().accept(this);
			final Stack<Pair<Variable, ? extends LogicalExpression>> currentStack = new Stack<Pair<Variable, ? extends LogicalExpression>>();
			// To avoid the case of variables shared through various
			// structures, replace the current variable with a new one in
			// the inner body. This is a safe and simple way to solve this
			// problem. More efficient solutions are possible.
			final Variable newVariable = new Variable(innerLambda
					.getArgument().getType());
			// The result contains in the first place the processed body of
			// the inner lambda.
			currentStack.push(Pair.of(
					newVariable,
					ReplaceExpression.of(result.first(),
							innerLambda.getArgument(), newVariable)));
			// Append stack from sub tree
			currentStack.addAll(result.second());
			result = Pair.of(newVariable, currentStack);
		} else {
			throw new IllegalStateException("invalid A expression: "
					+ literal);
		}
	} else {
		literal.getPredicate().accept(this);
		final Pair<? extends LogicalExpression, Stack<Pair<Variable, ? extends LogicalExpression>>> newPredPair = result;

		final LogicalExpression[] newArgs = new LogicalExpression[len];
		final List<Stack<Pair<Variable, ? extends LogicalExpression>>> newStacks = new ArrayList<Stack<Pair<Variable, ? extends LogicalExpression>>>(
				len);
		boolean argsChanged = false;
		for (int i = 0; i < len; ++i) {
			final LogicalExpression arg = literal.getArg(i);
			arg.accept(this);
			newArgs[i] = result.first();
			newStacks.add(result.second());
			if (arg != result.first()) {
				argsChanged = true;
			}
		}

		// Merge stacks returned from all arguments.
		final Stack<Pair<Variable, ? extends LogicalExpression>> mergedStack = new Stack<Pair<Variable, ? extends LogicalExpression>>();
		for (final Stack<Pair<Variable, ? extends LogicalExpression>> stack : newStacks) {
			mergedStack.addAll(stack);
		}

		if (argsChanged || newPredPair.first() != literal.getPredicate()) {
			result = Pair.of(new Literal(newPredPair.first(), newArgs),
					mergedStack);
		} else {
			result = Pair.of(literal, mergedStack);
		}
	}

	// Try to wrap the literal with existential quantifiers.
	result = Pair.of(wrapIfPossible(result.first(), result.second()),
			result.second());

}
 
Example 19
Source File: GetAllSkolemTerms.java    From amr with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}
 
Example 20
Source File: HasUnusedVariable.java    From spf with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(LogicalExpression logicalExpression) {
	logicalExpression.accept(this);
}