Function without_restatements

Source
pub fn without_restatements(names: Vec<String>) -> Vec<String>
Expand description

Drops, from one tag’s list of names, the ones that only say again what the other entries of that same list already say.

Real tags do this constantly. A file of War Pigs carries PERFORMER=Ozzy Osbourne; Judas Priest; Judas Priest & Ozzy Osbourne: three values, two musicians. The third is the credit written out whole, and nothing in the string alone tells it from a band name — & is never a separator here, and rightly, or Kool & the Gang would be shattered.

The list itself is what tells them apart, and it is not a heuristic. A value made of two or more of the other values in the same tag, with nothing left over but the words that join names together, is the file saying one thing twice. Keeping the granular form loses nobody: every person it named is still named, and each is now an artist in their own right rather than a third party who happens to exist on one track. Kool & the Gang survives any list that does not also hold Kool and the Gang on their own — and a list that did would have named them itself.

The comparison is on normalized keys, so joining punctuation has already fallen away and only joining words remain to be recognised.