Python-Datamuse¶
Description¶
Python wrapper for Datamuse API
Installation¶
Example¶
Note that the default number of results is set to 100. You can set the default max to something else using the
set_max_default
method, e.g.api.set_max_default(300)
. Datamuse only returns 1000 results max.
Parameters for word
methods¶
Description of the method
This endpoint returns a list of words (and multiword expressions) from a given vocabulary that match a given set of constraints. See https://www.datamuse.com/api/ for the official Datamuse API documentation for the
/words
endpoint. :param**kwargs
: Query parameters of constraints and hints. :return: A list of words matching that match the given constraints.
- Means like
ml
- Sounds like
sl
- Spelled like
sp
- Related word
rel_[code]
jja
Popular nouns modified by the given adjective. (gradual → increase)jjb
Popular adjectives used to modify the given noun. (beach → sandy)syn
Synonyms (ocean → sea)trg
"Triggers" (words that are statistically associated with the query word in the same piece of text.) (cow → milking)ant
Antonyms (late → early)spc
"Kind of" direct hypernyms (gondola → boat)gen
"More genaral than" direct hyponyms (boat → gondola)com
"Comprises" direct holonyms (car → accelerator)par
"part of" direct meronyms (trunk → tree)bga
Frequent followers (wreak → havoc)bgb
Frequent predecessors (havoc → wreak)rhy
Rhymes (spade → aid)nry
Approximate rhymes (forest → chorus)hom
Homophones, sound-alike (course → coarse)cns
Consonant match (sample → simple)
- Identifier for the vocabulary to use,
v
, if none is provided will use \(550,000\) term from English. the valuees
specify \(500,000\) term, the valueenwiki
specifies and approximately 6 millions-term. - Topic words
topics
(An optional hint to the system about the theme of the document being written) - Left context
lc
An optional hint to the system about the word that appears immediately to the left of the target word in a sentence. - Right context
rc
An optional hint to the system about the word that appears immediately to the right of the target word in a sentence. - Maximum
max
-
Metadata flag
md
A list of single-letter codes (no delimiter) requesting that extra lexical knowledge be included with the results.Letter Description d
Definitions p
Parts of speech s
Syllable count r
Pronunciation f
word frequency -
Query echo
qe
This is useful for looking up metadata about specific words. For example,/words?sp=flower&qe=sp&md=fr
can be used to get the pronunciation and word frequency for flower.
Parameters for suggest
methods¶
s
Prefix hint string; typically, the characters that the user has entered so far into a search box.max
Maximum number of results to return.v
Identifier for the vocabulary to use.