From fbcfbb67f879a3b10b53699b3bfa99e9c9821a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maik=20Fr=C3=B6be?= Date: Tue, 8 Oct 2024 18:50:50 +0200 Subject: [PATCH] adjust order of term extraction --- ir_axioms/axiom/term_similarity.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ir_axioms/axiom/term_similarity.py b/ir_axioms/axiom/term_similarity.py index d20b97b..3cc9e19 100644 --- a/ir_axioms/axiom/term_similarity.py +++ b/ir_axioms/axiom/term_similarity.py @@ -21,9 +21,9 @@ def preference( document1: RankedDocument, document2: RankedDocument ): + query_terms = context.term_set(query) document1_terms = context.term_set(document1) document2_terms = context.term_set(document2) - query_terms = context.term_set(query) return strictly_greater( self.average_similarity(document1_terms, query_terms), @@ -63,10 +63,11 @@ def preference( is non-deterministic if there are multiple equally most similar pairs. """ + query_terms = context.term_set(query) document1_terms = context.term_set(document1) document2_terms = context.term_set(document2) document_terms = document1_terms | document2_terms - query_terms = context.term_set(query) + non_query_terms = document_terms - query_terms most_similar_terms = self.most_similar_pair(