NEw analysis stuff

This commit is contained in:
Stephan Porada
2020-01-27 16:11:34 +01:00
parent b4427cd3ec
commit 4b0e9392a7
3 changed files with 97 additions and 71 deletions

View File

@ -44,7 +44,6 @@ class CQiWrapper(CQiClient):
'''
p_attrs = self.corpus_positional_attributes(self.corpus_name)
struct_attrs = self.corpus_structural_attributes(self.corpus_name)
logger.warning('struct_attrs: {}'.format(struct_attrs))
self.attr_strings = {}
self.attr_strings['positional_attrs'] = {}
self.attr_strings['struct_attrs'] = {}
@ -137,9 +136,15 @@ class CQiWrapper(CQiClient):
self.attr_strings['positional_attrs']['word']
)
self.nr_matches = min(result_len, self.match_count)
if self.nr_matches == 0:
if self.match_count == 0:
logger.warning('Query resulted in 0 matches.')
return None
self.results = {'code': 0,
'result': {'matches': [],
'match_count': self.match_count,
'cpos_lookup': {},
'text_lookup': {}}
}
return self.results
else:
# Get match cpos boundries
# match_boundries shows the start and end cpos of one match as a
@ -200,7 +205,7 @@ class CQiWrapper(CQiClient):
'result': {'matches': all_matches,
'match_count': self.match_count,
'cpos_lookup': all_cpos_infos,
'text_lookup': text_lookup,}
'text_lookup': text_lookup}
}
return self.results