Skip to main content

This is a simple python package to generate random english words

Project description

random-word

PyPI PyPI - Python Version PyPI - Status Codacy Badge License: MIT

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

  1. To generate single random word we can ue 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
    
  2. To generate list of random word we can ue 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 by alpha or count (optional)
    • sortOrder (string) - Sort direction by asc or desc (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']
    
  3. To get word of the day

    • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Random Word-1.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

Random_Word-1.0.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file Random Word-1.0.1.tar.gz.

File metadata

  • Download URL: Random Word-1.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Random Word-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8543241a4576e6f6dce2660553c6cdad6ac1307b2deb39d8e80c885816d5f4a2
MD5 75088429e64144f6668436bb23b18635
BLAKE2b-256 f9e3b54bd7b9177fe19a70cf25b603a0e515cb880b16bc595eee0d69ac95433c

See more details on using hashes here.

File details

Details for the file Random_Word-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for Random_Word-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9003137450cfc27def64908d3cd7d45d0145adaf7ed1dd360f8d263fb5fdc54
MD5 82e6b3e3ab93e0d968d476403ad4fb09
BLAKE2b-256 25fb7c35371c670a9e60cf27a6ae0da57d40ce6ab4fbdf58a93bf3db47151ab1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page