mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-27 20:04:17 +00:00
32 lines
961 B
Python
32 lines
961 B
Python
|
from .api import APIClient
|
||
|
from .constants import MAJOR_VERSION, MINOR_VERSION
|
||
|
from .models.corpora import CorpusCollection
|
||
|
|
||
|
|
||
|
class CQiClient(APIClient):
|
||
|
def __init__(self, host, port=4877):
|
||
|
super(CQiClient, self).__init__(host, port=port)
|
||
|
|
||
|
def connect(self, username='anonymous', password=''):
|
||
|
super(CQiClient, self).setup()
|
||
|
self.ctrl_connect(username, password)
|
||
|
self.__load()
|
||
|
|
||
|
def disconnect(self):
|
||
|
self.ctrl_bye()
|
||
|
super(CQiClient, self).teardown()
|
||
|
|
||
|
def __load(self):
|
||
|
self.corpora = CorpusCollection(self)
|
||
|
self.info = {'version': '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)}
|
||
|
|
||
|
def features(self):
|
||
|
features = []
|
||
|
if self.ask_feature_cqi_1_0():
|
||
|
features.append('cqi_1_0')
|
||
|
if self.ask_feature_cl_2_3():
|
||
|
features.append('cl_2_3')
|
||
|
if self.ask_feature_cqp_2_3():
|
||
|
features.append('cqp_2_3')
|
||
|
return features
|