diff --git a/docker/docker-compose.dev.yaml b/docker/docker-compose.dev.yaml index b2f96be8a16bb8a0c5aefc1d96c9c8ec9d04a80b..0f5fc5807266a31c8e393cab28fe77c65dbf3974 100644 --- a/docker/docker-compose.dev.yaml +++ b/docker/docker-compose.dev.yaml @@ -33,8 +33,8 @@ services: python -m debugpy --wait-for-client --listen 0.0.0.0:5678 \ /app/src/prototype/app.py retrieval \ --nrb-conclusions-per-topic 100 --nrb-premises-per-conclusion 50 \ - --reranking argument-graph --reuse-unranked /data/unranked.plk \ - test-run /data/topics.xml /data/results/ + --reranking maximal-marginal-relevance --reuse-unranked /data/unranked.plk \ + test-run-new /data/topics.xml /data/results/ # entrypoint: # - "/bin/sh" # - -ecx diff --git a/python/src/prototype/app.py b/python/src/prototype/app.py index b055a03ddf8ddf88625f5f79d23bbb42fd380aea..5ed5f4055b818823bd50db0eee061f1d2ca75eb7 100644 --- a/python/src/prototype/app.py +++ b/python/src/prototype/app.py @@ -42,7 +42,9 @@ class App: ).index_to_es() def _retrieval(self) -> None: - run_name = self.config['RERANKING'] if self.config['RERANKING'] else 'double-index-semantic' + run_name = f"{self.config['RUN_NAME']}-" + run_name += self.config['RERANKING'] if self.config['RERANKING'] \ + else 'double-index-semantic' self.logger.info('Reading topics...') topics = read_topics(self.config['TOPICS_PATH'], self.config['TOPIC_NRB']) self.logger.info('Read topics!') @@ -53,7 +55,7 @@ class App: self.logger.info('Read unranked!') else: results = Retrieval(topics, - self.config['RUN_NAME'], + run_name, self.config['ELASTIC_HOST'], self.config['NRB_CONCLUSIONS_PER_TOPIC'], self.config['NRB_PREMISES_PER_CONCLUSION'] diff --git a/python/src/prototype/retrieval/reranking.py b/python/src/prototype/retrieval/reranking.py index 7e2a5c183e4e1787ea1482517ffaa206ee680415..b065ad87ee512a5a87fe29dc96f40f32e36cbcd2 100644 --- a/python/src/prototype/retrieval/reranking.py +++ b/python/src/prototype/retrieval/reranking.py @@ -58,7 +58,10 @@ class Reranking: for premises_per_conclusion in premises_pre_conclusions.values(): conclusion = premises_per_conclusion['conclusion'] for premise in premises_per_conclusion['premises']: - if not premise['_id'] in encountered_premise_ids: + stance_conclusion = conclusion['_source']['sentence_stance'] + stance_premise = premise['_source']['sentence_stance'] + if stance_conclusion == stance_premise \ + and premise['_id'] not in encountered_premise_ids: trec_style_rows.append( (topic_nrb, conclusion['_source']['sentence_stance'], diff --git a/python/src/prototype/utils/__init__.py b/python/src/prototype/utils/__init__.py index d17577031bafef5f81de050fcb1b65a26b947d80..6b6dd8b180bc31cdb26317bf5199d21df27be8c6 100644 --- a/python/src/prototype/utils/__init__.py +++ b/python/src/prototype/utils/__init__.py @@ -5,3 +5,4 @@ from utils.structural_distance import structural_distance from utils.maximal_marginal_relevance import mmr_score, mmr_generic from utils.reader import (read_data_to_index, read_results, read_unranked, read_sentences, read_topics) +from utils.write_output import write_output