https://github.com/ndyag/mw-dict
Node.js wrapper of Merriam Webster Dictionary & Thesaurus Developer API
https://github.com/ndyag/mw-dict
dictionary english merriam-webster
Last synced: 3 months ago
JSON representation
Node.js wrapper of Merriam Webster Dictionary & Thesaurus Developer API
- Host: GitHub
- URL: https://github.com/ndyag/mw-dict
- Owner: NdYAG
- License: mit
- Created: 2017-09-01T02:25:27.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-03-13T03:31:05.000Z (3 months ago)
- Last Synced: 2025-03-13T04:26:01.485Z (3 months ago)
- Topics: dictionary, english, merriam-webster
- Language: TypeScript
- Homepage:
- Size: 742 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mw-dict
**Node.js Wrapper for Merriam Webster Dictionary Developer API**
* Supports **Collegiate® Dictionary** & **Learner's Dictionary**
* Supports **Collegiate® Thesaurus**
* Exports word senses with hierarchy (sense, subsense...)
* Outputs pronunciation audio url
* Cares about functional label, synonyms, verbal illustrations ...
* Outputs popularityPreview:

Note: Please get your API Key from [Merriam-Webster's Developer Center](http://www.dictionaryapi.com/)
## install
```shell
npm install mw-dict
```## usage
```js
import { CollegiateDictionary, LearnersDictionary, CollegiateThesaurus } from 'mw-dict'const dict = new CollegiateDictionary(API_KEY)
// const dict = new LearnersDictionary(API_KEY)
// const thesaurus = new CollegiateThesaurus(API_KEY)dict
.lookup(QUERY_WORD)
.then(result => {})
.catch(error => {})
````result` interface
```js
// result: Definition[]
// Definition
{
word: String,
functional_label: String,
pronunciation: String[],
definition: Sense[],
popularity: String
}
// Sense
{
number: String,
meanings: String[],
synonyms: String[],
antonyms: String[],
illustrations: String[],
senses: Sense[]
}
```Error handler
```js
import { WordNotFoundError } from 'mw-dict'dict
.lookup(QUERY_WORD)
.catch(error => {
if (error instanceof WordNotFoundError) {
// error.suggestion
}
})
```