vaibhavsingh97 / random-word

This is a simple python package to generate random english words
https://pypi.org/project/random-word/
MIT License
123 stars 25 forks source link

r.get_random_words() sometimes returns an empty list #67

Open madappally opened 3 years ago

madappally commented 3 years ago

Describe the bug r.get_random_words() sometimes returns an empty list. Is that a problem with API used to generate words?

To Reproduce

def generate_randome():
    r = RandomWords()
    the_list = r.get_random_words(limit=10)
illyanyc commented 3 years ago

I have the same issue, looks like r.get_random_words() sometimes returns an empty list

arixank commented 3 years ago

yes it does, return an empty word even on r.get_random_word()..!

madappally commented 3 years ago

I think it's a problem with the API used to generate words. Do they've any limits or something?

illyanyc commented 3 years ago

passing the following params into RandomWords solved the problem, works fine in production.

I think including hasDictionaryDef and includePartOfSpeech is necessary.

r = RandomWords() mnemonic_list = r.get_random_words(hasDictionaryDef="true", includePartOfSpeech="noun,verb", minLength=4, maxLength=6, sortBy="alpha", sortOrder="asc", imit=24)