See LICENSEĪll contributions are welcome and we hope Wonderwords will continue growing. Wonderwords is open source and is distributed under the MIT license. Starting with versionĢ alpha, Wonderwords uses sematic versioning. Therefore, versions before v2.0.0-alpha are in disarray. s: generate a simple sentence with an adjectiveĭuring its early stages, Wonderwords didn't have a set versioning system and.ss: simple sentence (bare bone sentence with direct object).Usage: usage: wonderwords [-s : generate a random sentence: Wonderwords provides a command line interface, too, which can be used with the The full documentation with all information More advanced usage (and a tutorial!) is found in the documentation, such asĪdding custom categories of words. bare_bone_with_adjective () # Get a random sentence with a subject, predicate, direct object and adjective s. simple_sentence () # Get a random bare-bone sentence with an adjective s. bare_bone_sentence () # Get a random bare-bone sentence with a direct object s. Generating random sentences is easy using the RandomSentence class: from wonderwords import RandomSentence s = RandomSentence () # Get a random bare-bone sentence s. random_words ( 100, starts_with = "n", word_min_length = 16, return_less_if_necessary = True ) random_words ( 100, starts_with = "n", word_min_length = 16 ) # there are less than 100 words that are at least 16 letters long and start with # n, so an exception is raised # you can silence the NoWordsToChooseFrom exception and return all words even # if there are less, by setting return_less_if_necessary to True r. 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. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |