Continue new list building for results

This commit is contained in:
Stephan Porada
2020-02-03 12:58:40 +01:00
parent e95cc42a22
commit 21371efde6
4 changed files with 65 additions and 66 deletions

View File

@ -287,12 +287,14 @@ class CQiWrapper(CQiClient):
first_cpos, last_cpos = match_cpos_list[0], match_cpos_list[-1]
context_sentences = {}
s_ids = self.cl_cpos2struc(key, [first_cpos, last_cpos])
logger.warning('s id match: {}'.format(s_ids))
for s_id in s_ids:
s_start, s_end = self.cl_struc2cpos(key, s_id)
s_cpos = list(range(s_start, s_end + 1))
context_sentences[s_id] = s_cpos
if get_surrounding_s:
max_s_id = self.cl_attribute_size(key)
max_s_id = self.cl_attribute_size(key) - 1
logger.warning('max sid: {}'.format(max_s_id))
additional_s_ids = []
additional_s = list(range(max(s_ids[0]
- l_r_s_context_additional_len,
@ -302,6 +304,7 @@ class CQiWrapper(CQiClient):
max_s_id) + 1))
additional_s_ids.extend(additional_s)
for s_id in additional_s_ids:
logger.warning('s id additional: {}'.format(s_id))
s_start, s_end = self.cl_struc2cpos(key, s_id)
s_cpos = list(range(s_start, s_end + 1))
context_sentences[s_id] = s_cpos