Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2b01299

Browse files
add invert_then_tiebreak argument to process_line Argument Queries
This addition was neededSo the queries of the form "inside nth argument" would work properly. In particular, for these type of queries tiebreaking Needs to happen after inversion because we need to pick the closest call that satisfies the nth description with respect to its (local) parent. Otherwise, the result produced would not be even deterministic,as helpful will not be ordered!!!
1 parent e4a6b57 commit 2b01299

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎queries/argument.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def get_statement(self,origin,atok):
6262

6363
def process_line(self,q, root ,atok, origin = None, select_node = None,tiebreaker = lambda x: x,
6464
line = None, transformation = None,inverse_transformation = None, priority = {},
65-
constrained_space = (), second_tiebreaker = None
65+
constrained_space = (), second_tiebreaker = None,invert_then_tiebreak=True
6666
):
6767
result = None
6868
alternatives = None
@@ -131,7 +131,10 @@ def process_line(self,q, root ,atok, origin = None, select_node = None,tiebreak
131131
helpful = [result] if result else []
132132
if alternatives:
133133
helpful.extend(alternatives)
134-
temporary = make_flat([tiebreaker(inverse_transformation(x)) for x in helpful])
134+
if invert_then_tiebreak:
135+
temporary = make_flat([tiebreaker(inverse_transformation(x)) for x in helpful])
136+
else:
137+
temporary = tiebreaker(make_flat([inverse_transformation(x) for x in helpful]))
135138
result, alternatives = obtain_result(None,temporary)
136139

137140
################################################################
@@ -144,7 +147,7 @@ def process_line(self,q, root ,atok, origin = None, select_node = None,tiebreak
144147
temporary = [x[1] for x in temporary]
145148
result,alternatives = obtain_result(None,temporary)
146149

147-
if second_tiebreaker:
150+
if resultandsecond_tiebreaker:
148151
alternatives = second_tiebreaker(result,alternatives)
149152

150153
if self.global_constrained_space:
@@ -359,7 +362,7 @@ def inverse_transformation(node):
359362
tiebreaker = lambda x: tiebreak_on_lca(statement_node,origin,x,lca),
360363
transformation = transformation,
361364
inverse_transformation = inverse_transformation,
362-
365+
invert_then_tiebreak=False
363366
)
364367
return self._backward_result(result, alternatives,build)
365368

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /