Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Hit-Girl
code
Commits
0991aba6
Commit
0991aba6
authored
Jan 29, 2022
by
Jerome Wuerf
Browse files
Implement stance restriction on premise retrieval
parent
dffb6b10
Changes
2
Hide whitespace changes
Inline
Side-by-side
docker/docker-compose.dev.yaml
View file @
0991aba6
...
...
@@ -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
...
...
python/src/prototype/retrieval/retrieval.py
View file @
0991aba6
...
...
@@ -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
:
"""
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment