shortest_unique_names
- negmas.helpers.shortest_unique_names(strs, sep='.', max_compression=False, guarantee_unique=False)[source]
Finds the shortest unique strings starting from the end of each input string based on the separator.
The final strings will only be unique if the inputs are unique.
- Parameters:
sep – The separator used to separate fields in each string
max_compression – If True, each string will be further compressed by taking the shortest prefix that keeps the strings unique (if they were originally unique)
guarantee_unique – If given, random characters will be postfixed on strings to guarantee uniquness
Example
given [“a.b.cat”, “d.e.f”, “a.d.cat”] it will generate [“b.c”, “f”, “d.cat”] if max_compression was false and will generate [“b”, “f”, “d”] if it was True