mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-12 17:10:41 +00:00
First output of query results
This commit is contained in:
@ -43,13 +43,13 @@ def recv_query(message):
|
||||
analysis_client = analysis_clients[request.sid]
|
||||
""" Prepare and execute a query """
|
||||
corpus = 'CORPUS'
|
||||
query = '"and";'
|
||||
query = message['query']
|
||||
query_subcorpus = 'Results'
|
||||
analysis_client.cqp_query(corpus, query_subcorpus, query)
|
||||
""" Evaluate query results """
|
||||
match_corpus = '{}:{}'.format(corpus, query_subcorpus)
|
||||
match_num = analysis_client.cqp_subcorpus_size(match_corpus)
|
||||
match_num = min(19, match_num)
|
||||
match_num = min(int(message['hits_per_page']) - 1, match_num)
|
||||
if match_num == 0:
|
||||
print('No matches found.')
|
||||
exit()
|
||||
@ -67,6 +67,7 @@ def recv_query(message):
|
||||
pos = analysis_client.cl_cpos2str('{}.pos'.format(corpus), range(match_start, match_end + 1))
|
||||
matches.append({'tokens': tokens, 'pos': pos})
|
||||
logger.warning(matches)
|
||||
socketio.emit('query_results', matches, room=request.sid)
|
||||
|
||||
|
||||
def observe_corpus_analysis_connection(app, corpus_id, session_id):
|
||||
|
Reference in New Issue
Block a user