Skip to content

Commit

Permalink
mf
Browse files Browse the repository at this point in the history
  • Loading branch information
mam10eks committed Dec 12, 2024
1 parent a2fbab1 commit 3d68d4d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ir_axioms/axiom/query_aspects.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,19 @@ def preference(
document1: RankedDocument,
document2: RankedDocument
):
query_terms = context.term_set(query)
query_terms = set(context.term_set(query))
s1, s2 = set(), set()

for query_term in query_terms:
if context.term_frequency(document1, query_term) > 0:
s1.add(query_term)
if context.term_frequency(document2, query_term) > 0:
s2.add(query_term)

if not all(i in s1 for i in query_terms):
s1 = set()
if not all(i in s2 for i in query_terms):
s2 = set()

return strictly_greater(s1, s2)


Expand Down Expand Up @@ -233,6 +237,7 @@ def preference(
document2_terms = context.term_set(document2)
query_term_count1 = query_terms & document1_terms
query_term_count2 = query_terms & document2_terms

return strictly_greater(len(query_term_count1), len(query_term_count2))


Expand Down

0 comments on commit 3d68d4d

Please sign in to comment.