Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
Yann Esposito (Yogsototh) 48d94fee6d
benchmarks
pirms 1 gada
dictionaries added some dictionaries pirms 1 gada
src/HFIG fixed the doctests pirms 1 gada
src-benchmark benchmarks pirms 1 gada
src-doctest fixed the doctests pirms 1 gada
src-exe fixed the doctests pirms 1 gada
src-test added command line and lovecraftian gen pirms 1 gada
.dir-locals.el benchmarks pirms 1 gada
.gitignore initial commit pirms 1 gada
.hlint.yaml initial commit pirms 1 gada
.travis.yml initial commit pirms 1 gada
CHANGELOG.md initial commit pirms 1 gada
LICENSE initial commit pirms 1 gada
README.md Externalize dictionaries (for now) pirms 1 gada
Setup.hs initial commit pirms 1 gada
human-friendly-id-gen.cabal benchmarks pirms 1 gada
package.yaml benchmarks pirms 1 gada
shell.nix fixed the doctests pirms 1 gada
stack.yaml initial commit pirms 1 gada

README.md

human-friendly-id-gen

New Haskell project to generate Human Friendly Ids.

Those ids should be easier to read / write and remember than classical random base64 ids.

The package provide both a lib and an executable hfig (for Human Friendly Identifier Generator).

Strategies

There are different strategies depending on your preferences.

Short strategy

We generate random phonemes that should be not too hard to pronounce but in the same time having sufficiently different phonemes to be able to have not too long words to prevent collision.

rupomdovi
waziridro
moplaloxo
kankujochplu
drubrusadka
dripuxmopbi
jotchibluzuv
plotabrprabudr
zopranblokplab
tirbrozprakow

Here is the probability of collision if you generate a sample of n of those words:

n %
1000 2.5e-8
10k 2.5e-6
100k 2.5e-4
1M 2.5e-2

You can also ask to use more phonemes if you only use 2 phonemes which generate words like:

blilwa
wirpa
winupl
tani
ludu
probrip
pichprox
joprux
drudibl
zibrku

The probility of collision become:

n %
10 1e-5
100 1e-3
1k 0.11
10k 1.0

Lovecraftian strategy

My nickname isn’t yogsototh for nothing so why not generate as if Lovecraft could have invented them.

ymhiovhotl
zhaobritl
v'odher
neltha
ucnouthlaxr
kola
adavhig
ctuthrilbh
yakthembru
athoubr'murh

The probability collision table looks like:

n %
10 6.669334400426838e-8
100 6.669334400426838e-6
1k 6.669334400426837e-4
10k 6.669334400426838e-2
100k 1.0

if you generate two names for an id, you should be safe.

n %
10 8.8e-17
100 8.8e-15
1k 8.8e-13
10k 8.8e-11
100k 8.8e-9
1M 8.8e-7

Dictionary Strategy

You can read any file and each line will be considered as a word. We then take a few random words.

You can gather some word list in this repository to use.

There is a default english dictionary with approximatively 370k English words.

Here is an example:

shuckins-digitinerved-microspectrophotometrical
indeterminableness-getaways-sceloporus
diverts-okayed-cast
semirhythmically-thasian-thrawart
smashups-phototherapeutics-swollenness
bindingness-phoenicia-ringy
execs-axes-barotaxis
monimiaceous-presutural-submembers
heterodyned-pourparley-zecchino
fragmentate-contrude-taeniae

And here are the different table of collision probability.

use 1 word to make the identifier:

n %
10 1.3e-4
100 1.3e-2
1k 1.0

combine 2 words to make the identifier:

n %
10 3.6e-10
100 3.6e-8
1k 3.6e-6
10k 3.6e-4
100k 3.6e-2
1M 1.0

combine 3 words to make the identifier:

n %
10 9.8e-16
100 9.8e-14
1k 9.8e-12
10k 9.8e-10
100k 9.8e-8
1M 9.8e-6