How much vocabulary range it has? #11
Replies: 2 comments 2 replies
-
Hello! I'm glad you found my library useful. Currently, I am using 4 dictionaries for nouns, verbs, adjectives and curse words (curse words are disabled by default). They're found here. With Wonderwords version 2.2 (the latest version; upgrade with from wonderwords import RandomWord
# Read the text file with the words from fantasy novels
# and add the words to a list.
with open("fantasy_words.txt") as f:
words = f.readlines()
# Now remove newlines (\n) from the words
words = [i.strip() for i in words]
# Finally, remove empty strings (caused by extra
# newlines at the end of the file).
words = [i for i in words if i]
# Here's where the magic happens. We create a RandomWord
# object with our list of words. Here, we create a category called
# 'fantasy_words' and set it to our list of words. This category
# is like nouns and verbs, except for our own custom words.
generator = RandomWord(fantasy_words=words)
# Finally, we can perform all the same operations with our
# custom words:
generator.word(starts_with="dr") # dragon The example above is a brief summary. If you want to learn more about custom categories, check out the advanced tutorial. I hope that helps! If you have any more questions or problems, please let me know. |
Beta Was this translation helpful? Give feedback.
-
Since this is a question about the use-case, I'll convert it to a discussion. |
Beta Was this translation helpful? Give feedback.
-
Hey there,
I am lucky I got here, exactly what I was in need of.
Just need to ask, which dictionary are you using to get the random word?
Also is there any method to incorporate words from fantasy novels and other genres?
If yes, will methods like starts_with and ends_with work for newly added words?
Thanks in advance!!
Beta Was this translation helpful? Give feedback.
All reactions