Skip to content

Command Line Interface

Maxim R edited this page May 4, 2020 · 6 revisions

Command Line Interface

Wonderwords has a command line interface that comes from installing it through PyPI where you can easily generate random words and sentences from the terminal.

Table of contents


Basic Usage

usage: wonderwords [-h] [-n] [-v] [-a] [-min MIN] [-max MAX] [-amount AMOUNT]
                   [-sep SEP] [-s] [-sw SW] [-stype STYPE]
                   mode

Positional arguments

To user wonderwords you first specify the positional argument mode. There are three options:

  • rw: to generate random words
  • rl: to generate a list of random words
  • rs: to generate a random sentence

For example:

$ wonderwords rw
unarmed

Optional arguments

Here are optional arguments you can add to enhance the generation of random words, lists and sentences:

Optional arguments for rw mode

If none of the optional arguments for this mode are specified, using the mode will generate a random word from a list of nouns, verbs and adjectives. The arguments below can enhance the generation of the word. For example:

Generate a noun or verb with a minimum length of four chatacters and a maximum length of ten characters.

$ wonderwords rw -n -v -min 4 -max 10
variation

Specify parts of speech:

When none of the part of speech options below are chosen, all parts of speech will be generated. If one or more of these part of speech arguments are used, only words of the specified parts of speech will be generated.

  • -n: Include nouns.
  • -v: Include verbs.
  • -a: Include adjectives.

Specify length of words:

Here you can specify the minimum length of the random word, maximum length or both.

  • -min MIN: The minimum length of the word. Ex: -min 4 will give a word at least four letters long.
  • -max MAX: The maximum length of the word. Ex: -max 7 will give a word with at most 7 letters

Specify what the word starts with:

  • -sw SW: Type one letter that the word starts with. Ex: -sw a will generate a word that starts with a

Optional arguments for rl mode

rl mode generates a python list of random words. However you can customize the word types, lengths and separators between the words in the list. For example:

Generate a list of 5 adjectives separated by , and with spaces after each ,:

$ wonderwords rl -amount 5 -a -sep , -s
fearless, yellow, slow, belligerent, shy

Specify the amount of words in the list:

  • -amount AMOUNT: The amount of words you want in the random list. Ex: -amount 5 will return a list of 5 words.

Specify the separators in-between words in the list:

  • -sep SEP: What you want in-between words in the list. Ex: -sep " & " will separate all words in the list with &. Keep in mind the spaces or else the & will be squished between the words like&so.
  • -s: add a space after the separator. Ex: wonderwords rl -amount 2 -sep "," -s will return this: stomach, red. Notice the space in between the , and r.

Specify parts of speech:

When none of the part of speech options below are chosen, all parts of speech will be generated. If one or more of these part of speech arguments are used, only words of the specified parts of speech will be generated.

  • -n: Include nouns.
  • -v: Include verbs.
  • -a: Include adjectives.

Specify length of words:

Here you can specify the minimum length of the random word, maximum length or both.

  • -min MIN: The minimum length of the word. Ex: -min 4 will give a word at least four letters long.
  • -max MAX: The maximum length of the word. Ex: -max 7 will give a word with at most 7 letters

Optional arguments for rs mode

There is only one optional argument for rs mode (more to come!) that specifies the type of sentence:

  • -stype STYPE: -stype will specify the type of sentence to generate. Look below for options.

Options for -stype:

  • bb: Will generate a bare bone sentence in the form of: The [noun] [verb]s
  • ss: Will generate a simple sentence in the form of The [noun] [verb]s [direct object]
  • bba: Will generate a bare bone sentence with an adjective in the form of The [adjective] [noun] [verb]s
  • s: Will generate a sentence in the form of The [adjective] [noun] [verb]s [direct object]