Commit 0991aba6 authored by Jerome Wuerf's avatar Jerome Wuerf
Browse files

Implement stance restriction on premise retrieval

parent dffb6b10
......@@ -31,10 +31,9 @@ services:
- -ecx
- |
python -m debugpy --wait-for-client --listen 0.0.0.0:5678 \
/app/src/prototype/app.py retrieval \
/app/src/prototype/app.py retrieval --topic-nrb 51 \
--nrb-conclusions-per-topic 100 --nrb-premises-per-conclusion 50 \
--reranking maximal-marginal-relevance --reuse-unranked /data/unranked.plk \
test-run-new /data/topics.xml /data/results/
test-run /data/topics.xml /data/results/
# entrypoint:
# - "/bin/sh"
# - -ecx
......
......@@ -88,11 +88,19 @@ class Retrieval:
return premise_per_conclusion_per_topic
def _get_premises(self, conclusion: dict) -> dict:
return self.es.search(index='premise',
body=self._get_query_body(
self.nrb_premises_per_conclusion,
conclusion['_source']['sentence_vector'])
)
body = self._get_query_body(self.nrb_premises_per_conclusion,
conclusion['_source']['sentence_vector'])
del body['query']['script_score']['query']['match_all']
body['query']['script_score']['query'] = {'bool': {
'must': {
'match': {
'sentence_stance': conclusion['_source']['sentence_stance']
}
}
}
}
return self.es.search(index='premise', body=body)
def _get_query_body(self, size: int, sentence_embedding: np.ndarray) -> dict:
"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment