Acronym generation algorithm

Status
Not open for further replies.

Alexandre

Ars Tribunus Militum
1,781
Subscriptor
I've been working on a project where a kanban wall is built from github issues from many repos, and I've been thinking on how to identify which repo an issue came from. The basica idea I came up with was to have a legend style list of repos, color coded to the color of its issues.

Then I started thinking how it would look like if you added lots of repos, and it would probably look weird as a long list of names. So I thought about instead of displaying the full name of the repo, display a shorthand version of it's name, like an acronym. I looked around if there were any algorithms that generate acronyms from words/names/phrases, but couldn't find anything too helpful.

The best I could find with was this: http://www.jiwonpark.kr/AA-aka-Abbreviation-Algorithm. On this page they present some possible algorithms to use, and it can be a starting point, but not really what I was looking for.

My rough idea for the algorithm:
  1. given a list of names
    Code:
    ['foo-user-agent', 'foo-dispatcher', 'foo-platform', 'foo-this-has-a-long-name']
  2. generate possible acronyms for the names
    Code:
    {'foo-user-agent': ['FUA', 'FUSA', 'UAG', ...],
     ...,
     'foo-this-has-a-long-name': ['FTHALN', 'FoTHALNa', 'ALN', ...]
    }
  3. use a soundex style algorithm to discard the acronyms that look like an acronym of another name
  4. profit!

Does anyone knows of something that works like this?
 

Schluppy

Ars Tribunus Militum
2,486
I wrote something similar to your "rough idea" a few years ago for acronyming company names but, for step 3, discarded if the current iteration matched an existing acronym.

IIRC, I removed the vowels then created sets (cartesian product?) of consonants and picked the shortest one that didn't already exist.

A set of words like "I got mine cut hair shorter too" would return sets like

Code:
[0] => I
[1] => G
[2] => M
[3] => C
[4] => H
[5] => S
[6] => T

// to

[0] => I
[1] => T
[2] => N
[3] => T
[4] => R
[5] => R
[6] => T

It was clunky but, for a limited set of names, it worked.
 
Status
Not open for further replies.