Skip to content

Commit 4910b8e

Browse files
authored
Merge pull request nltk#3386 from eidheim/develop
Corrected ResolutionProver.find_answers
2 parents 1642942 + 7e04484 commit 4910b8e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

nltk/inference/resolution.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ def find_answers(self, verbose=False):
141141
answers = set()
142142
answer_ex = VariableExpression(Variable(ResolutionProver.ANSWER_KEY))
143143
for clause in self._clauses:
144-
for term in clause:
145-
if (
146-
isinstance(term, ApplicationExpression)
147-
and term.function == answer_ex
148-
and not isinstance(term.argument, IndividualVariableExpression)
149-
):
150-
answers.add(term.argument)
144+
if (
145+
len(clause) == 1
146+
and isinstance(clause[0], ApplicationExpression)
147+
and clause[0].function == answer_ex
148+
and not isinstance(clause[0].argument, IndividualVariableExpression)
149+
):
150+
answers.add(clause[0].argument)
151151
return answers
152152

153153
@staticmethod

0 commit comments

Comments
 (0)