Re: Long string to short ID

Ian Hobson <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <[email protected]>
Hi Lloyd

On 13/08/2021 20:44, Lloyd R. Prentice wrote:
> Hello,
> 
> What might be a nifty way to turn a long book title with spaces into a short human-readable ID?
> 
> Thanks,
> 
> LRP
>
I can think of two ways.

1) Append the initials of the title (perhaps omitting short functions 
words like "The", "Of" etc) to the initials of the Author. Also it would 
help to convert numbers to digits first.

"The Four Hour Work Week", by Tim Ferriss becomes  TF4HWW

Its easy to remember and may even be guessable in context.

2) You could hash the title and express the result in a high base (being 
careful to avoid confusable letters (I1l, O0 etc), and append that to 
the Author's initials.

So the example might be TFkUw4

This would probably make all the keys a similar length, but would not be 
guessable.

In both cases you will have to have some way to recognise name clashes, 
and disambiguate them - perhaps adding -1, -2 etc to the duplicates.

Regards

Ian

-- 
Ian Hobson
Tel (+351) 910 418 473

-- 
This email has been checked for viruses by AVG.
https://www.avg.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.