in src/models/struxgpt_base.py [0:0]
def convert_struct_output(self, hi:int = 0, fi:int = 1) -> str:
scope = remove_punc(self.scope)
total_aspects = ', '.join([remove_punc(aspect.name, lowercase=True) for aspect in self.aspects])
res = ''
## head (scope)
if hi == 0:
res += f'{upper_start(scope)}.\n'
elif hi == 1:
res += f'About {scope}:\n'
elif hi == 2:
res += f'{upper_start(scope)} involves {total_aspects}:\n'
elif hi == 3:
res += f'{upper_start(scope)} involves several aspects:\n'
elif hi == 4:
res += f'{upper_start(scope)} involves several main aspects with corresponding descriptive statements:\n'
elif hi == 5:
res += f'This passage talks about {scope}, involving several aspects:\n'
elif hi == 6:
res += f'\n'
else:
raise NotImplementedError(f'Head {hi}')
# format (aspects and descriptions)
if fi == 0:
# numerical hierarchy
for ai, aspect in enumerate(self.aspects):
res += f'{ai+1}. {aspect.name}\n'
for di, desc in enumerate(aspect.get_descs()):
res += f' {ai+1}.{di+1}. {desc}\n'
return res
for ai, aspect in enumerate(self.aspects):
aspect_title = remove_punc(aspect.name, lowercase=True)
aspect_title = upper_start(aspect_title)
descs = upper_start(aspect.get_descs(merge=True))
if fi == 1:
res += f'{ai+1}. {aspect_title}: {descs}\n'
elif fi == 2:
res += f'**{aspect_title}**: {descs}\n'
else:
raise NotImplementedError(f'Format {fi}')
res = res[:-1]
return res