Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

petname -a --count N should produce names with different starting letters #60

Closed
sshilovsky opened this issue Apr 6, 2022 · 2 comments · Fixed by #102
Closed

petname -a --count N should produce names with different starting letters #60

sshilovsky opened this issue Apr 6, 2022 · 2 comments · Fixed by #102
Labels
enhancement future For a future major version; maybe a breaking change

Comments

@sshilovsky
Copy link

sshilovsky commented Apr 6, 2022

Command: petname --count 1000 -a | cut -c 1 | sort | uniq | wc -l

Produced result: 1

Expected result: anything but 1 pretty much every time

@allenap
Copy link
Owner

allenap commented Apr 6, 2022

The -a / --alliterate flag finds first letters that are present in all word lists, picks one of those letters at random, then removes all words that don't begin with that letter, before carrying on as normal. As implemented right now, the answer from that command will always be 1 as you've discovered.

The use-case I originally had in mind for this was something like choosing a new Ubuntu release name, where you want lots of choices but with the first letters always the same. However, that's better handled with the newer -A / --alliterate-with flag, so I think you're right: -a / --alliterate should ensure a common first letter for components of each composed name. The restriction of having the same letter for the whole stream is excessive.

@allenap
Copy link
Owner

allenap commented Apr 6, 2022

A workaround for now:

petname --stream | egrep '^(.).*-\1' | head -n 1000

@allenap allenap added the future For a future major version; maybe a breaking change label Sep 12, 2023
@allenap allenap mentioned this issue Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement future For a future major version; maybe a breaking change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants