Skip to main content

datamuse-cli

A command line interface for the Datamuse API.

Installation

This tool isn't uploaded to pypi yet because the name datamuse-cli is already taken there...

pip install [TO_BE_DETERMINED]

Usage

See datamuse --help for usage information:

usage: datamuse [-h] [-n MAX_RESULTS] [-f {csv,line,json}] [-m [METADATA]]
                [-t TOPICS] [-l LEFT_CONTEXT] [-r RIGHT_CONTEXT]
                [-V {es,enwiki}] [-q QUERY_ECHO] [-d] [-v]
                mode word

Unofficial command line interface for the Datamuse API. Datamuse API
documentation: https://www.datamuse.com/api/

positional arguments:
  mode                  Type of word relationship to query:
                          ml - "Means like" (words with similar meanings)
                          sl - "Sounds like" (words with similar
                                pronunciation)
                          sp - "Spelled like" (words with similar
                                spelling)
                          rhy - Rhymes with
                          n2a - "Noun to adjective" (adjectives commonly
                                used to describe the given noun)
                          a2n - "Adjective to noun" (nouns commonly
                                modified by the given adjective)
                          syn - Synonyms
                          ant - Antonyms
                          trg - "Triggers" (words statistically
                                associated with the query word in the same
                                piece of text)
                          spc - More specific terms (hyponyms)
                          gen - More general terms (hypernyms)
                          com - "Comprises" (direct holonyms)
                          par - "Part of" (direct meronyms)
                          fol - Frequent followers
                          pre - Frequent predecessors
                          hom - Homophones (sound-alike words)
                          cns - Consonant match
                          sug - Suggestions (autocomplete)
  word                  Word or phrase to query

options:
  -h, --help            show this help message and exit
  -n, --max-results MAX_RESULTS
                        Maximum number of results to return (default: 10)
  -f, --format {csv,line,json}
                        Output format: comma-separated, line-by-line, or JSON
                        (default: csv)
  -m, --metadata [METADATA]
                        Which metadata to include in results. Options include:
                        - d (definitions)
                        - p (parts of speech)
                        - s (syllable count)
                        - r (pronunciation)
                        - f (word frequency)
                        If omitted, no metadata is included. If specified
                        without a value, all metadata is included: 'dpsrf'.
  -t, --topics TOPICS   Optional topic words. Results will be skewed toward
                        these topics. At most 5 words can be specified. Space
                        or comma delimited. Nouns work best.
  -l, --left-context LEFT_CONTEXT
                        Left context: an optional hint about the word that
                        appears immediately to the left. (Only a single word
                        may be specified.)
  -r, --right-context RIGHT_CONTEXT
                        Right context: an optional hint about the word that
                        appears immediately to the right. (Only a single word
                        may be specified.)
  -V, --vocabulary {es,enwiki}
                        Identifier for alternative vocabulary to use. By
                        default, a 550,000-term English vocabulary is used.
  -q, --query-echo QUERY_ECHO
                        Query echo: see Datamuse documentation for details.
  -d, --debug           Enable debug mode. This will print the API request to
                        the console.
  -v, --version         show program's version number and exit

(Note that compared to the Datamuse API, this tool reverses the meanings of the
"spc" and "gen" parameters.)

Examples

Words that have similar meanings to "happy":

$ datamuse ml happy
pleased, blissful, content, glad, contented, joyful, euphoric, joyous, fortunate, riant

Words that sound like "spot":

$ datamuse sl spot
spot, spott, spout, spit, spite, spat, spate, sput, spight, spet

Adjectives that are often used to modify the noun "tree", skewed toward the topic of "Carribean":

$ datamuse --topics carribean a2n tree
tropical, mango, small, entire, stately, shady, giant, famous, lemon, palm

Hyponyms (more specific terms) of "stone":

$ datamuse spc stone
calculus, cornerstone, crystal, conglomerate, capstone, gravel, marble, sill, lava, magma

Three antonyms of "day", returned in JSON format, with pronunciation and frequency metadata:

$ datamuse -n 3 -f json -m rf ant day
[
  {
    "word": "night",
    "score": 3407,
    "tags": [
      "pron:N AY1 T ",
      "f:145.767264"
    ]
  },
  {
    "word": "dark",
    "score": 2295,
    "tags": [
      "pron:D AA1 R K ",
      "f:68.871627"
    ]
  },
  {
    "word": "nighttime",
    "score": 988,
    "tags": [
      "pron:N AY1 T T AY0 M ",
      "f:1.016966"
    ]
  }
]

Future features

The Datamuse API supports queries involving a spelling filter alongside other parameters, for instance "words that have a similar meaning to 'point' and have 'o' as the third letter":

https://api.datamuse.com/words?ml=point&sp=??o*

Currently, the datamuse-cli tool does not support this feature.

Datamuse API page

https://www.datamuse.com/api/

Metadata

Release files for datamuser 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datamuser 0.1.1
File Size Uploaded Provenance
datamuser-0.1.1.tar.gz 5.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for datamuser 0.1.1
File Interpreter ABI Platform
datamuser-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / datamuser-0.1.1.tar.gz

Download URL datamuser-0.1.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
41c8dc0500b954c14b2c16ea152464f82d29992269320bd37515095cba3a052d
BLAKE2b-256 checksum
How to use checksums
85075d0abbb96bb7a6d450fbd763668f28b56633f5c28bdf9ff1edb264118dd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.1

Release files / datamuser-0.1.1-py3-none-any.whl

Download URL datamuser-0.1.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea0b2a4aa95f9361ad1e8dfb8a84707cb923f746478fb996a48071a6e6372ebb
BLAKE2b-256 checksum
How to use checksums
bb65d42a77a807a636a44bf3a145b4090583c29e35f9a7eb83955d81044f06e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.1

Security for datamuser 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page