wonderwords


Namewonderwords JSON
Version 2.2.0 PyPI version JSON
download
home_pagehttps://github.com/mrmaxguns/wonderwordsmodule
SummaryA python package for random words and sentences in the english language
upload_time2021-02-17 20:28:45
maintainer
docs_urlNone
authorMaxim Rebguns
requires_python>=3.6
license
keywords
VCS
bugtrack_url
requirements colorama commonmark importlib-resources Pygments rich typing-extensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Wonderwords

**Generate random words and sentences with ease in python**

![PyPI - Downloads](https://img.shields.io/pypi/dm/wonderwords?style=for-the-badge)
![Libraries.io SourceRank](https://img.shields.io/librariesio/sourcerank/pypi/wonderwords?style=for-the-badge)
![PyPI - License](https://img.shields.io/pypi/l/wonderwords?style=for-the-badge)
https://github.com/mrmaxguns/wonderwordsmodule/workflows/Python%20package/badge.svg

**Quick links:**

 * [GitHub repository](https://github.com/mrmaxguns/wonderwordsmodule)
 * [PyPI page](https://pypi.org/project/wonderwords)
 * [Official Documentation](https://wonderwords.readthedocs.io)

***

Wonderwords is a python package useful for generating random words and
structured random sentences. It also comes with a colorful command line
interface for quickly generating random words. The latest version is available
[on GitHub](https://github.com/mrmaxguns/wonderwordsmodule) while the stable
version is available [on PyPI](https://pypi.org/project/wonderwords).

## Table of Contents

- Features
- Installation
- Usage
  - The Wonderwords Python API
  - The Wonderwords CLI
- Versioning
- License
- Contributing
- Credits

## Features

Here's what Wonderwords is capable of:

- Random word generation
- Specify word length, what it starts and ends with, category, and even custom
  regular expressions!
- Use custom word lists and define custom categories of words
- Beautiful command line interface
- Easy-to-use interface and comprehensive documentation
- Open source!

## Installation

To install the latest version of Wonderwords, use your favorite package manager
for the Python Package Index to install the ``wonderwords`` package. For example
with pip:

```bash
pip install wonderwords
```

To upgrade Wonderwords with pip use:

```bash
pip install --upgrade wonderwords
```

To verify that the installation worked, import Wonderwords in python:

```python
import wonderwords
```

If you get a `ModuleNotFound` error, make sure that you have installed
Wonderwords from the step above. For further issues,
[open a new issue from the GitHub page](https://github.com/mrmaxguns/wonderwordsmodule/issues/new/choose).

## Usage

This section will briefly describe Wonderwords usage. Since Wonderwords has
a command line interface and python module, you will find two subsections.

### The Wonderwords Python API

The base random word generation class is the `RandomWord` class. You can
generate words with the `word` method:

```python
from wonderwords import RandomWord

r = RandomWord()

# generate a random word
r.word()

# random word that starts with a and ends with en
r.word(starts_with="a", ends_with="en")

# generate a random noun or adjective, by default all parts of speech are included
r.word(include_parts_of_speech=["nouns", "adjectives"])

# generate a random word between the length of 3 and 8 characters
r.word(word_min_length=3, word_max_length=8)

# generate a random word with a custom regular expression
r.word(regex=".*a")

# you can combine multiple filtering options
r.word(starts_with="ru", word_max_length=10, include_parts_of_speech=["verbs"])
```

You can also get a list of all words matching some criteria using the `filter`
method:

```python
# get a list of ALL words that start with "am"
r.filter(starts_with="am")

# you can use all the options found in the word method:
r.filter(ends_with="k", include_parts_of_speech=["verbs"], word_min_length=4)
```

You can also generate a random list of words with the `random_words` method.
This is much like the filter method, except you specify the amount of words
to return, and the words are randomly chosen. If there aren't enough words to
satisfy the amount, a `NoWordsToChooseFrom` exception is raised:

```python
# get a list of 3 random nouns
r.random_words(3, include_parts_of_speech=["nouns"])

# you can use all the options found in the word method
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(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(100, starts_with="n", word_min_length=16, return_less_if_necessary=True)
```

Generating random sentences is easy using the `RandomSentence` class:

```python
from wonderwords import RandomSentence

s = RandomSentence()

# Get a random bare-bone sentence
s.bare_bone_sentence()

# Get a random bare-bone sentence with a direct object
s.simple_sentence()

# Get a random bare-bone sentence with an adjective
s.bare_bone_with_adjective()

# Get a random sentence with a subject, predicate, direct object and adjective
s.sentence()
```

More advanced usage (and a tutorial!) is found in the documentation, such as
adding custom categories of words. The full documentation with all information
can be found at: https://wonderwords.readthedocs.io

## The Wonderwords CLI

Wonderwords provides a command line interface, too, which can be used with the
`wonderwords` command. Usage:

```
usage: wonderwords [-h] [-w] [-f] [-l LIST] [-s {bb,ss,bba,s}] [-v] [-sw STARTS_WITH] [-ew ENDS_WITH]
                   [-p {noun,verb,adjective,nouns,verbs,adjectives} [{noun,verb,adjective,nouns,verbs,adjectives} ...]] [-min WORD_MIN_LENGTH]
                   [-max WORD_MAX_LENGTH] [-r REGEX] [-d DELIMITER]

optional arguments:
  -h, --help            show this help message and exit
  -w, --word, --random-word
                        generate a random word
  -f, --filter          filter a list of words matching the criteria specified
  -l LIST, --list LIST  return a list of words of a certain length
  -s {bb,ss,bba,s}, --sentence {bb,ss,bba,s}
                        return a sentence based on the structure chosen
  -v, --version         Print the version number and exit
  -sw STARTS_WITH, --starts-with STARTS_WITH
                        specify what string the random word(s) should start with
  -ew ENDS_WITH, --ends-with ENDS_WITH
                        specify what string the random word(s) should end with
  -p {noun,verb,adjective,nouns,verbs,adjectives} [{noun,verb,adjective,nouns,verbs,adjectives} ...], --parts-of-speech {noun,verb,adjective,nouns,verbs,adjectives} [{noun,verb,adjective,nouns,verbs,adjectives} ...]
                        specify to only include certain parts of speech (by default all parts of speech are included)
  -min WORD_MIN_LENGTH, --word-min-length WORD_MIN_LENGTH
                        specify the minimum length of the word(s)
  -max WORD_MAX_LENGTH, --word-max-length WORD_MAX_LENGTH
                        specify the maximum length of the word(s)
  -r REGEX, --regex REGEX, --re REGEX, --regular-expression REGEX
                        specify a python-style regular expression that every word must match
  -d DELIMITER, --delimiter DELIMITER
                        Specify the delimiter to put between a list of words, default is ', '

```

The basic commands are:

  * `-w`: generate a random word
  * `-f`: which works much like the `filter` function to return all words matching
    a certain criteria
  * `-l LIST`: get a list of `LIST` random words
  * `-s {bb,ss,bba,s}`: generate a random sentence:
    * `bb`: bare bone sentence
    * `ss`: simple sentence (bare bone sentence with direct object)
    * `bba`: bare bone sentence with adjective
    * `s`: generate a simple sentence with an adjective

# Versioning

During its early stages, Wonderwords didn't have a set versioning system and
therefore, versions before `v2.0.0-alpha` are in disarray. Starting with version
2 alpha, Wonderwords uses **sematic versioning**.

# License

Wonderwords is open source and is distributed under the MIT license. See LICENSE
for more details.

# Contributing

All contributions are welcome and we hope Wonderwords will continue growing.
Start out by reading `CONTRIBUTING.md` for contributing guidelines and how to
get started.

# Credits

Wonderwords has been made possible thanks to the following works:

- `profanitylist.txt` from
  [RobertJGabriel/Google-profanity-words](https://github.com/RobertJGabriel/Google-profanity-words)
  under the
  [Apache-2.0 license](https://github.com/RobertJGabriel/Google-profanity-words/blob/master/LICENSE)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mrmaxguns/wonderwordsmodule",
    "name": "wonderwords",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Maxim Rebguns",
    "author_email": "mrmaxguns@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f3/ed/d5f4336a7b1b416d5c502a6ed323f02acdb5e67467ef8f5e80ea6617fe3e/wonderwords-2.2.0.tar.gz",
    "platform": "",
    "description": "# Wonderwords\n\n**Generate random words and sentences with ease in python**\n\n![PyPI - Downloads](https://img.shields.io/pypi/dm/wonderwords?style=for-the-badge)\n![Libraries.io SourceRank](https://img.shields.io/librariesio/sourcerank/pypi/wonderwords?style=for-the-badge)\n![PyPI - License](https://img.shields.io/pypi/l/wonderwords?style=for-the-badge)\nhttps://github.com/mrmaxguns/wonderwordsmodule/workflows/Python%20package/badge.svg\n\n**Quick links:**\n\n * [GitHub repository](https://github.com/mrmaxguns/wonderwordsmodule)\n * [PyPI page](https://pypi.org/project/wonderwords)\n * [Official Documentation](https://wonderwords.readthedocs.io)\n\n***\n\nWonderwords is a python package useful for generating random words and\nstructured random sentences. It also comes with a colorful command line\ninterface for quickly generating random words. The latest version is available\n[on GitHub](https://github.com/mrmaxguns/wonderwordsmodule) while the stable\nversion is available [on PyPI](https://pypi.org/project/wonderwords).\n\n## Table of Contents\n\n- Features\n- Installation\n- Usage\n  - The Wonderwords Python API\n  - The Wonderwords CLI\n- Versioning\n- License\n- Contributing\n- Credits\n\n## Features\n\nHere's what Wonderwords is capable of:\n\n- Random word generation\n- Specify word length, what it starts and ends with, category, and even custom\n  regular expressions!\n- Use custom word lists and define custom categories of words\n- Beautiful command line interface\n- Easy-to-use interface and comprehensive documentation\n- Open source!\n\n## Installation\n\nTo install the latest version of Wonderwords, use your favorite package manager\nfor the Python Package Index to install the ``wonderwords`` package. For example\nwith pip:\n\n```bash\npip install wonderwords\n```\n\nTo upgrade Wonderwords with pip use:\n\n```bash\npip install --upgrade wonderwords\n```\n\nTo verify that the installation worked, import Wonderwords in python:\n\n```python\nimport wonderwords\n```\n\nIf you get a `ModuleNotFound` error, make sure that you have installed\nWonderwords from the step above. For further issues,\n[open a new issue from the GitHub page](https://github.com/mrmaxguns/wonderwordsmodule/issues/new/choose).\n\n## Usage\n\nThis section will briefly describe Wonderwords usage. Since Wonderwords has\na command line interface and python module, you will find two subsections.\n\n### The Wonderwords Python API\n\nThe base random word generation class is the `RandomWord` class. You can\ngenerate words with the `word` method:\n\n```python\nfrom wonderwords import RandomWord\n\nr = RandomWord()\n\n# generate a random word\nr.word()\n\n# random word that starts with a and ends with en\nr.word(starts_with=\"a\", ends_with=\"en\")\n\n# generate a random noun or adjective, by default all parts of speech are included\nr.word(include_parts_of_speech=[\"nouns\", \"adjectives\"])\n\n# generate a random word between the length of 3 and 8 characters\nr.word(word_min_length=3, word_max_length=8)\n\n# generate a random word with a custom regular expression\nr.word(regex=\".*a\")\n\n# you can combine multiple filtering options\nr.word(starts_with=\"ru\", word_max_length=10, include_parts_of_speech=[\"verbs\"])\n```\n\nYou can also get a list of all words matching some criteria using the `filter`\nmethod:\n\n```python\n# get a list of ALL words that start with \"am\"\nr.filter(starts_with=\"am\")\n\n# you can use all the options found in the word method:\nr.filter(ends_with=\"k\", include_parts_of_speech=[\"verbs\"], word_min_length=4)\n```\n\nYou can also generate a random list of words with the `random_words` method.\nThis is much like the filter method, except you specify the amount of words\nto return, and the words are randomly chosen. If there aren't enough words to\nsatisfy the amount, a `NoWordsToChooseFrom` exception is raised:\n\n```python\n# get a list of 3 random nouns\nr.random_words(3, include_parts_of_speech=[\"nouns\"])\n\n# you can use all the options found in the word method\nr.random_words(5, starts_with=\"o\", word_min_length=10)\n\n# if the amount of words you want to get is larger than the amount of words\n# there are, a NoWordsToChooseFrom exception is raised:\nr.random_words(100, starts_with=\"n\", word_min_length=16)\n# there are less than 100 words that are at least 16 letters long and start with\n# n, so an exception is raised\n\n# you can silence the NoWordsToChooseFrom exception and return all words even\n# if there are less, by setting return_less_if_necessary to True\nr.random_words(100, starts_with=\"n\", word_min_length=16, return_less_if_necessary=True)\n```\n\nGenerating random sentences is easy using the `RandomSentence` class:\n\n```python\nfrom wonderwords import RandomSentence\n\ns = RandomSentence()\n\n# Get a random bare-bone sentence\ns.bare_bone_sentence()\n\n# Get a random bare-bone sentence with a direct object\ns.simple_sentence()\n\n# Get a random bare-bone sentence with an adjective\ns.bare_bone_with_adjective()\n\n# Get a random sentence with a subject, predicate, direct object and adjective\ns.sentence()\n```\n\nMore advanced usage (and a tutorial!) is found in the documentation, such as\nadding custom categories of words. The full documentation with all information\ncan be found at: https://wonderwords.readthedocs.io\n\n## The Wonderwords CLI\n\nWonderwords provides a command line interface, too, which can be used with the\n`wonderwords` command. Usage:\n\n```\nusage: wonderwords [-h] [-w] [-f] [-l LIST] [-s {bb,ss,bba,s}] [-v] [-sw STARTS_WITH] [-ew ENDS_WITH]\n                   [-p {noun,verb,adjective,nouns,verbs,adjectives} [{noun,verb,adjective,nouns,verbs,adjectives} ...]] [-min WORD_MIN_LENGTH]\n                   [-max WORD_MAX_LENGTH] [-r REGEX] [-d DELIMITER]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -w, --word, --random-word\n                        generate a random word\n  -f, --filter          filter a list of words matching the criteria specified\n  -l LIST, --list LIST  return a list of words of a certain length\n  -s {bb,ss,bba,s}, --sentence {bb,ss,bba,s}\n                        return a sentence based on the structure chosen\n  -v, --version         Print the version number and exit\n  -sw STARTS_WITH, --starts-with STARTS_WITH\n                        specify what string the random word(s) should start with\n  -ew ENDS_WITH, --ends-with ENDS_WITH\n                        specify what string the random word(s) should end with\n  -p {noun,verb,adjective,nouns,verbs,adjectives} [{noun,verb,adjective,nouns,verbs,adjectives} ...], --parts-of-speech {noun,verb,adjective,nouns,verbs,adjectives} [{noun,verb,adjective,nouns,verbs,adjectives} ...]\n                        specify to only include certain parts of speech (by default all parts of speech are included)\n  -min WORD_MIN_LENGTH, --word-min-length WORD_MIN_LENGTH\n                        specify the minimum length of the word(s)\n  -max WORD_MAX_LENGTH, --word-max-length WORD_MAX_LENGTH\n                        specify the maximum length of the word(s)\n  -r REGEX, --regex REGEX, --re REGEX, --regular-expression REGEX\n                        specify a python-style regular expression that every word must match\n  -d DELIMITER, --delimiter DELIMITER\n                        Specify the delimiter to put between a list of words, default is ', '\n\n```\n\nThe basic commands are:\n\n  * `-w`: generate a random word\n  * `-f`: which works much like the `filter` function to return all words matching\n    a certain criteria\n  * `-l LIST`: get a list of `LIST` random words\n  * `-s {bb,ss,bba,s}`: generate a random sentence:\n    * `bb`: bare bone sentence\n    * `ss`: simple sentence (bare bone sentence with direct object)\n    * `bba`: bare bone sentence with adjective\n    * `s`: generate a simple sentence with an adjective\n\n# Versioning\n\nDuring its early stages, Wonderwords didn't have a set versioning system and\ntherefore, versions before `v2.0.0-alpha` are in disarray. Starting with version\n2 alpha, Wonderwords uses **sematic versioning**.\n\n# License\n\nWonderwords is open source and is distributed under the MIT license. See LICENSE\nfor more details.\n\n# Contributing\n\nAll contributions are welcome and we hope Wonderwords will continue growing.\nStart out by reading `CONTRIBUTING.md` for contributing guidelines and how to\nget started.\n\n# Credits\n\nWonderwords has been made possible thanks to the following works:\n\n- `profanitylist.txt` from\n  [RobertJGabriel/Google-profanity-words](https://github.com/RobertJGabriel/Google-profanity-words)\n  under the\n  [Apache-2.0 license](https://github.com/RobertJGabriel/Google-profanity-words/blob/master/LICENSE)\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A python package for random words and sentences in the english language",
    "version": "2.2.0",
    "project_urls": {
        "Homepage": "https://github.com/mrmaxguns/wonderwordsmodule"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b4a46a7705c6e17de71e45782a0284e06691f85350adb80b1dea9c027c07f024",
                "md5": "3d71daa8459cca33573a03df326bb786",
                "sha256": "65fc665f1f5590e98f6d9259414ea036bf1b6dd83e51aa6ba44473c99ca92da1"
            },
            "downloads": -1,
            "filename": "wonderwords-2.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3d71daa8459cca33573a03df326bb786",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 44970,
            "upload_time": "2021-02-17T20:28:43",
            "upload_time_iso_8601": "2021-02-17T20:28:43.977865Z",
            "url": "https://files.pythonhosted.org/packages/b4/a4/6a7705c6e17de71e45782a0284e06691f85350adb80b1dea9c027c07f024/wonderwords-2.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f3edd5f4336a7b1b416d5c502a6ed323f02acdb5e67467ef8f5e80ea6617fe3e",
                "md5": "da368c0d1baa599739663d1b4d7fe8aa",
                "sha256": "0b7ec6f591062afc55603bfea71463afbab06794b3064d9f7b04d0ce251a13d0"
            },
            "downloads": -1,
            "filename": "wonderwords-2.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "da368c0d1baa599739663d1b4d7fe8aa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 50579,
            "upload_time": "2021-02-17T20:28:45",
            "upload_time_iso_8601": "2021-02-17T20:28:45.402383Z",
            "url": "https://files.pythonhosted.org/packages/f3/ed/d5f4336a7b1b416d5c502a6ed323f02acdb5e67467ef8f5e80ea6617fe3e/wonderwords-2.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-02-17 20:28:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mrmaxguns",
    "github_project": "wonderwordsmodule",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "colorama",
            "specs": [
                [
                    "==",
                    "0.4.4"
                ]
            ]
        },
        {
            "name": "commonmark",
            "specs": [
                [
                    "==",
                    "0.9.1"
                ]
            ]
        },
        {
            "name": "importlib-resources",
            "specs": [
                [
                    "==",
                    "5.1.0"
                ]
            ]
        },
        {
            "name": "Pygments",
            "specs": [
                [
                    "==",
                    "2.7.4"
                ]
            ]
        },
        {
            "name": "rich",
            "specs": [
                [
                    "==",
                    "9.10.0"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    "==",
                    "3.7.4.3"
                ]
            ]
        }
    ],
    "lcname": "wonderwords"
}
        
Elapsed time: 1.42734s