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