mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 18:34:18 +00:00
Update
This commit is contained in:
parent
4ff372de77
commit
6e3579b33f
@ -1,5 +1,5 @@
|
||||
from time import sleep
|
||||
from .. import specification
|
||||
from . import specification
|
||||
from ..errors import cl_error_lookup, error_lookup, cqp_error_lookup
|
||||
import socket
|
||||
import struct
|
||||
|
@ -1,4 +1,4 @@
|
||||
from . import specification
|
||||
from .api import specification
|
||||
|
||||
|
||||
class CQiException(Exception):
|
||||
|
@ -64,5 +64,4 @@ class Corpus:
|
||||
return lookups
|
||||
|
||||
def query(self, query, subcorpus_name='Results'):
|
||||
self.client.api.cqp_query(self.name, subcorpus_name, query)
|
||||
return self.subcorpora.get('Results')
|
||||
return self.client.api.cqp_query(self.name, subcorpus_name, query)
|
||||
|
@ -1,4 +1,4 @@
|
||||
from ..specification import (CONST_FIELD_KEYWORD, CONST_FIELD_MATCH,
|
||||
from ..api.specification import (CONST_FIELD_KEYWORD, CONST_FIELD_MATCH,
|
||||
CONST_FIELD_MATCHEND, CONST_FIELD_TARGET)
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from .specification import MAJOR_VERSION, MINOR_VERSION
|
||||
from .api.specification import MAJOR_VERSION, MINOR_VERSION
|
||||
|
||||
|
||||
version = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
|
||||
|
@ -1,5 +1,5 @@
|
||||
from .api import APIClient
|
||||
from .specification import CONST_FIELD_MATCH, CONST_FIELD_MATCHEND
|
||||
from .api.specification import CONST_FIELD_MATCH, CONST_FIELD_MATCHEND
|
||||
import time
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ def corpus_analysis_query(query):
|
||||
return
|
||||
corpus = client.corpora.get('CORPUS')
|
||||
try:
|
||||
results = corpus.query(query)
|
||||
corpus.query(query)
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
response = str(e)
|
||||
@ -60,6 +60,7 @@ def corpus_analysis_query(query):
|
||||
response = {'code': 1}
|
||||
socketio.emit('corpus_analysis_query', response, room=request.sid)
|
||||
else:
|
||||
results = corpus.subcorpora.get('Results')
|
||||
chunk_size = 100
|
||||
chunk_start = 0
|
||||
context = 100
|
||||
|
@ -47,7 +47,15 @@ def pj_corpus_analysis_query(query):
|
||||
socketio.emit('pj_corpus_analysis_query', response, room=request.sid)
|
||||
return
|
||||
try:
|
||||
results = corpus.query(query)
|
||||
query_status = corpus.query(query)
|
||||
except cqi.errors.CQiException as e:
|
||||
response = {'code': 500, 'desc': None, 'msg': 'Internal Server Error',
|
||||
'payload': {'code': e.code, 'desc': e.description,
|
||||
'msg': e.name}}
|
||||
socketio.emit('pj_corpus_analysis_query', response, room=request.sid)
|
||||
return
|
||||
try:
|
||||
results = corpus.subcorpora.get('Results')
|
||||
except cqi.errors.CQiException as e:
|
||||
response = {'code': 500, 'desc': None, 'msg': 'Internal Server Error',
|
||||
'payload': {'code': e.code, 'desc': e.description,
|
||||
@ -55,7 +63,7 @@ def pj_corpus_analysis_query(query):
|
||||
socketio.emit('pj_corpus_analysis_query', response, room=request.sid)
|
||||
return
|
||||
response = {'code': 200, 'desc': None, 'msg': 'OK',
|
||||
'payload': {'num_matches': results.size}}
|
||||
'payload': {**query_status, 'num_matches': results.size}}
|
||||
socketio.emit('pj_corpus_analysis_query', response, room=request.sid)
|
||||
chunk_size = 100
|
||||
chunk_start = 0
|
||||
|
Loading…
Reference in New Issue
Block a user