if suffix:
for i, p in enumerate(cores):
cores[i] = p[:-len(suffix)]
+ longest_total = ''
+ for i in range(len(cores[0])):
+ temp_longest = find_longest_equal(cores, j=i, matcher='in')
+ if len(temp_longest) > len(longest_total):
+ longest_total = temp_longest
+ middle = longest_total
for i, p in enumerate(prompts):
+ remains = p[len(prefix):]
+ idx_middle = remains.index(middle)
+ second = remains[:idx_middle]
+ remains = remains[idx_middle + len(middle):]
+ first = remains[:-len(suffix)] if suffix else remains
pre_ell = '…' if prefix else ''
post_ell = '…' if suffix else ''
- prompts_diff[p] = f'{pre_ell}{cores[i]}{post_ell}'
+ prompts_diff[p] = f'{pre_ell}{first}…{second}{post_ell}'
return prompts_diff
basic_items_attrs = {}