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_defaultmethod, 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
/wordsendpoint. :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]jjaPopular nouns modified by the given adjective. (gradual → increase)jjbPopular adjectives used to modify the given noun. (beach → sandy)synSynonyms (ocean → sea)trg"Triggers" (words that are statistically associated with the query word in the same piece of text.) (cow → milking)antAntonyms (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)bgaFrequent followers (wreak → havoc)bgbFrequent predecessors (havoc → wreak)rhyRhymes (spade → aid)nryApproximate rhymes (forest → chorus)homHomophones, sound-alike (course → coarse)cnsConsonant match (sample → simple)
- Identifier for the vocabulary to use,
v, if none is provided will use \(550,000\) term from English. the valueesspecify \(500,000\) term, the valueenwikispecifies and approximately 6 millions-term. - Topic words
topics(An optional hint to the system about the theme of the document being written) - Left context
lcAn optional hint to the system about the word that appears immediately to the left of the target word in a sentence. - Right context
rcAn 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
mdA list of single-letter codes (no delimiter) requesting that extra lexical knowledge be included with the results.Letter Description dDefinitions pParts of speech sSyllable count rPronunciation fword frequency -
Query echo
qeThis is useful for looking up metadata about specific words. For example,/words?sp=flower&qe=sp&md=frcan be used to get the pronunciation and word frequency for flower.
Parameters for suggest methods¶
sPrefix hint string; typically, the characters that the user has entered so far into a search box.maxMaximum number of results to return.vIdentifier for the vocabulary to use.