Work on new list bilding

This commit is contained in:
Stephan Porada
2020-01-29 16:12:57 +01:00
parent c1adcb93ee
commit da4cc75943
4 changed files with 98 additions and 39 deletions

View File

@ -233,20 +233,26 @@ class CQiWrapper(CQiClient):
tmp_info[struct_attr_key].append(id)
else:
structs_to_check.append({key: struct_attr_key})
logger.warning('Structs to check: {}'.format(structs_to_check))
struct_attr_values = list(tmp_info.values())
# logger.warning('Struct attr value list: {}'.format(struct_attr_values))
struct_attr_keys = list(tmp_info.keys())
# logger.warning('Struct attr key list: {}'.format(struct_attr_keys))
# Build textlookup dictionary
text_lookup_ids = list(set(struct_attr_values[0])) # First is always one text
text_lookup = {}
text_lookup_ids = list(set(struct_attr_values[0])) # every CPOS is associated with one text id. A set is build to only gather text_lookup informations for every unique text id
text_lookup = {} # final dict containing all info of one text identified by its id
for d in structs_to_check:
s_key, s_value = zip(*d.items())
s_value = s_value[0].split('_', 1)[1]
logger.warning('dict entries: {}: {}'.format(s_key, s_value))
s_value = s_value[0].split('_', 1)[-1]
logger.warning('S_VALUE: {}'.format(s_value))
struct_values = self.cl_struc2str(s_key[0], text_lookup_ids)
logger.warning('Extracted Value with key {}: {}'.format(s_key[0],struct_values))
zipped = dict(zip(text_lookup_ids, struct_values))
for zip_key, zip_value in zipped.items():
logger.warning('key: {}'.format(zip_key))
logger.warning('value: {}'.format(zip_value))
logger.warning('Text id as key is: {}'.format(zip_key))
logger.warning('Value of this text is: {}'.format(zip_value))
check = text_lookup.get(zip_key)
logger.warning('check: {}'.format(check))
if check is None: