mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-12 17:10:41 +00:00
Add first things to get more context for one match.
This commit is contained in:
@ -294,4 +294,7 @@ class CQiWrapper(CQiClient):
|
||||
t1 = time.time()
|
||||
t_total = t1 - t0
|
||||
logger.warning('Got all sentences informations in {} seconds'. format(t_total))
|
||||
return context_sentences, all_cpos_infos, text_lookup
|
||||
match_context = {'context_s_cpos': context_sentences,
|
||||
'cpos_lookup': all_cpos_infos,
|
||||
'text_lookup': text_lookup}
|
||||
return match_context
|
||||
|
@ -42,7 +42,7 @@ def corpus_analysis(message):
|
||||
socketio.emit('query', '[424]: Failed Dependency',
|
||||
room=request.sid)
|
||||
return
|
||||
""" Prepare and execute a query """
|
||||
# Prepare and execute a query
|
||||
corpus_name = 'CORPUS'
|
||||
query = str(message['query'])
|
||||
result_len = int(message['hits_per_page'])
|
||||
@ -57,6 +57,21 @@ def corpus_analysis(message):
|
||||
socketio.emit('corpus_analysis', results, room=request.sid)
|
||||
|
||||
|
||||
@socketio.on('inspect_match')
|
||||
@login_required
|
||||
def inspect_match(message):
|
||||
client = corpus_analysis_clients.get(request.sid)
|
||||
if client is None:
|
||||
socketio.emit('query', '[424]: Failed Dependency',
|
||||
room=request.sid)
|
||||
return
|
||||
# Get more context for given match CPOS
|
||||
match_context = client.get_sentences(message['cpos'],
|
||||
get_surrounding_s=True,
|
||||
l_r_s_context_additional_len=3)
|
||||
socketio.emit('match_context', match_context, room=request.sid)
|
||||
|
||||
|
||||
def corpus_analysis_session_handler(app, corpus_id, session_id):
|
||||
with app.app_context():
|
||||
''' Setup analysis session '''
|
||||
|
Reference in New Issue
Block a user