This is a simple python package to generate random english words random word generator
Project description
random-word
This is a simple python package to generate random english words. If you need help after reading the below, please find me at @vaibhavsingh97 on Twitter.
If you love the package, please :star2: the repo.
Basic Setup
You should be able to install using easy_install
or pip
in the usual ways:
$ easy_install random-word
$ pip install random-word
Or just clone this repository and run:
$ python3 setup.py install
Or place the random-word
folder that you downloaded somewhere where it can be accessed by your scripts.
Basic Usage
from random_word import RandomWords
r = RandomWords()
# Return a single random word
r.get_random_word()
# Return list of Random words
r.get_random_words()
# Return Word of the day
r.word_of_the_day()
Advance Usage
-
To generate single random word we can use these optional parameters
hasDictionaryDef (string)
- Only return words with dictionary definitions (optional)includePartOfSpeech (string)
- CSV part-of-speech values to include (optional)excludePartOfSpeech (string)
- CSV part-of-speech values to exclude (optional)minCorpusCount (integer)
- Minimum corpus frequency for terms (optional)maxCorpusCount (integer)
- Maximum corpus frequency for terms (optional)minDictionaryCount (integer)
- Minimum dictionary count (optional)maxDictionaryCount (integer)
- Maximum dictionary count (optional)minLength (integer)
- Minimum word length (optional)maxLength (integer)
- Maximum word length (optional)
r.get_random_word(hasDictionaryDef="true", includePartOfSpeech="noun,verb", minCorpusCount=1, maxCorpusCount=10, minDictionaryCount=1, maxDictionaryCount=10, minLength=5, maxLength=10) # Output: pediophobia
-
To generate list of random word we can use these optional parameters
hasDictionaryDef (string)
- Only return words with dictionary definitions (optional)includePartOfSpeech (string)
- CSV part-of-speech values to include (optional)excludePartOfSpeech (string)
- CSV part-of-speech values to exclude (optional)minCorpusCount (integer)
- Minimum corpus frequency for terms (optional)maxCorpusCount (integer)
- Maximum corpus frequency for terms (optional)minDictionaryCount (integer)
- Minimum dictionary count (optional)maxDictionaryCount (integer)
- Maximum dictionary count (optional)minLength (integer)
- Minimum word length (optional)maxLength (integer)
- Maximum word length (optional)sortBy (string)
- Attribute to sort byalpha
orcount
(optional)sortOrder (string)
- Sort direction byasc
ordesc
(optional)limit (integer)
- Maximum number of results to return (optional)
r.get_random_words(hasDictionaryDef="true", includePartOfSpeech="noun,verb", minCorpusCount=1, maxCorpusCount=10, minDictionaryCount=1, maxDictionaryCount=10, minLength=5, maxLength=10, sortBy="alpha", sortOrder="asc", limit=15) # Output: ['ambivert', 'calcspar', 'deaness', 'entrete', 'gades', 'monkeydom', 'outclimbed', 'outdared', 'pistoleers', 'redbugs', 'snake-line', 'subrules', 'subtrends', 'torenia', 'unhides']
-
To get word of the day we can use these optional parameters
date (string)
- Fetches by date in yyyy-MM-dd (optional)
r.word_of_the_day(date="2018-01-01") # Output: {"word": "qualtagh", "definations": [{"text": "The first person one encounters, either after leaving one\'s home or (sometimes) outside one\'s home, especially on New Year\'s Day.", "source": "wiktionary", "partOfSpeech": "noun"}, {"text": "A Christmas or New Year\'s ceremony, in the Isle of Man; one who takes part in the ceremony. See the first extract.", "source": "century", "partOfSpeech": "noun"}]}
Issues
You can report the bugs at the issue tracker
License
Built with ♥ by Vaibhav Singh(@vaibhavsingh97) under MIT License
You can find a copy of the License at https://vaibhavsingh97.mit-license.org/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file Random Word-1.0.2.tar.gz
.
File metadata
- Download URL: Random Word-1.0.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1c5125aaf7f38692c535747507f2bc5a1518d4ff1c3f14df41610e6ce10c517 |
|
MD5 | 8533278572844d095c88218a2a785874 |
|
BLAKE2b-256 | 6a17dce5d7b70ca3ad451320d5139e76b6341b1dc530269979b93f1bc256bc56 |
File details
Details for the file Random_Word-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: Random_Word-1.0.2-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1bef401b75be62467d7cc088662137f03cfdcaa43ec4f43007a231af6cea40f |
|
MD5 | f7bed04d56526c248b988c413bbca4a4 |
|
BLAKE2b-256 | 592a9dd2f8fde274cade5f5981a16bd4c8635cc9b5c4bc5d0f05142633f5b7aa |