Add first query result function

This commit is contained in:
Stephan Porada
2019-11-18 16:07:07 +01:00
parent 5c8ca4e22d
commit 0ca4bf6030
4 changed files with 19 additions and 191 deletions

View File

@ -51,7 +51,7 @@ class CQiWrapper(CQiClient):
self.attr_strings['positional_attrs'][p_attr] = (self.corpus_name
+ '.'
+ p_attr)
for struct_attr in struct_attrs[:-1]:
for struct_attr in struct_attrs[2:-1]:
self.attr_strings['struct_attrs'][struct_attr] = (self.corpus_name
+ '.'
+ struct_attr)
@ -64,7 +64,6 @@ class CQiWrapper(CQiClient):
self.__create_attribute_strings()
logger.warning('{} does exist.'.format(corpus_name))
else:
self.disconnect()
logger.warning('{} does not exist.'.format(corpus_name))
def disconnect(self):
@ -126,7 +125,6 @@ class CQiWrapper(CQiClient):
self.nr_matches = min(result_len, self.nr_matches)
if self.nr_matches == 0:
logger.warning('Query resulted in 0 matches.')
self.disconnect
return None
else:
# Get match cpos boundries
@ -227,11 +225,14 @@ class CQiWrapper(CQiClient):
all_cpos)
cpos_infos[p_attr_key] = match_str
elif attr_dict == 'struct_attrs':
for struct_attr_key in self.attr_strings[attr_dict].keys():
struct_entry = self.cl_cpos2struc(self.attr_strings['struct_attrs'][self.meta_struct_element],
all_cpos)
match_str = self.cl_struc2str(self.attr_strings[attr_dict][struct_attr_key], struct_entry)
cpos_infos[struct_attr_key] = match_str
# for struct_attr_key in self.attr_strings[attr_dict].keys():
# logger.warning('HIER:' + struct_attr_key + " " + " " + self.attr_strings[attr_dict][struct_attr_key])
# struct_entry = self.cl_cpos2struc(self.attr_strings['struct_attrs'][self.meta_struct_element],
# all_cpos)
# logger.warning(struct_entry)
# match_str = self.cl_struc2str(self.attr_strings[attr_dict][struct_attr_key], struct_entry)
# cpos_infos[struct_attr_key] = match_str
pass
tmp_list = []
attr_key_list = []
for key in cpos_infos.keys():