random_words ( 5, starts_with = "o", word_min_length = 10 ) # if the amount of words you want to get is larger than the amount of words # there are, a NoWordsToChooseFrom exception is raised: r. random_words ( 3, include_parts_of_speech = ) # you can use all the options found in the word method r. Satisfy the amount, a NoWordsToChooseFrom exception is raised: # get a list of 3 random nouns r. To return, and the words are randomly chosen. This is much like the filter method, except you specify the amount of words You can also generate a random list of words with the random_words method. filter ( ends_with = "k", include_parts_of_speech =, word_min_length = 4 ) filter ( starts_with = "am" ) # you can use all the options found in the word method: r. Method: # get a list of ALL words that start with "am" r. You can also get a list of all words matching some criteria using the filter word ( starts_with = "ru", word_max_length = 10, include_parts_of_speech = ) word ( regex = ".*a" ) # you can combine multiple filtering options r. word ( word_min_length = 3, word_max_length = 8 ) # generate a random word with a custom regular expression r. word ( include_parts_of_speech = ) # generate a random word between the length of 3 and 8 characters r. word ( starts_with = "a", ends_with = "en" ) # generate a random noun or adjective, by default all parts of speech are included r. word () # random word that starts with a and ends with en r. Generate words with the word method: from wonderwords import RandomWord r = RandomWord () # generate a random word r. The base random word generation class is the RandomWord class. Since Wonderwords hasĪ command line interface and python module, you will find two subsections. This section will briefly describe Wonderwords usage. If you get a ModuleNotFound error, make sure that you have installed To verify that the installation worked, import Wonderwords in python: import wonderwords To upgrade Wonderwords with pip use: pip install -upgrade wonderwords To install the latest version of Wonderwords, use your favorite package managerįor the Python Package Index to install the wonderwords package.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |