OpenDictionaryAPI

OpenDictionaryAPI πŸŒŸπŸ“š

License: MIT Contributions Welcome Issues Forks Stars NPM Version Visitors

OpenDictionaryAPI is a free and open-source API that provides access to word definitions, synonyms, antonyms, pronunciations, and more. πŸ§‘β€πŸ’» Perfect for developers and language enthusiasts who want to integrate dictionary data into their applications. πŸš€


Features 🌟


Installation & Usage (NPM) πŸš€

Install the package from npm:

npm i opendictionaryapi

Example Usage:

const OpenDictionaryAPI = require("opendictionaryapi");

OpenDictionaryAPI.search('hi', 'en')
  .then(results => {
    console.log(results);
  })
  .catch(error => {
    console.log(error);
  });

Results Example:

[
  {
    "word": "hello",
    "phonetics": [
      {
        "audio": "https://api.dictionaryapi.dev/media/pronunciations/en/hello-au.mp3",
        "sourceUrl": "https://commons.wikimedia.org/w/index.php?curid=75797336",
        "license": {
          "name": "BY-SA 4.0",
          "url": "https://creativecommons.org/licenses/by-sa/4.0"
        }
      }
    ],
    "meanings": [
      {
        "partOfSpeech": "noun",
        "definitions": [
          {
            "definition": "\"Hello!\" or an equivalent greeting."
          }
        ]
      }
    ],
    "sourceUrls": [
      "https://en.wiktionary.org/wiki/hello"
    ]
  }
]

Error Example:

{
  "title": "No Definitions Found",
  "message": "Sorry pal, we couldn't find definitions for the word you were looking for.",
  "resolution": "You can try the search again at a later time or head to the web instead."
}

Direct API Usage πŸ”—

You can also directly fetch word data via the URL:

https://www.jsdelivr.com/package/gh/SH20RAJ/OpenDictionaryAPI/data/english/{word}.json

Example:

Fetch data for the word β€œhello”:

https://cdn.jsdelivr.net/gh/SH20RAJ/OpenDictionaryAPI/data/english/hello.json

Installation & Development πŸ› οΈ

  1. Clone the repository:
    git clone https://github.com/SH20RAJ/OpenDictionaryAPI.git
    
  2. Install dependencies:
    npm install
    
  3. Run the server:
    npm start
    

Contributing 🀝

We welcome contributions from the community! πŸ› οΈ To get started:

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature-name.
  3. Commit your changes: git commit -m "Added new feature".
  4. Push to your branch: git push origin feature-name.
  5. Submit a pull request. πŸŽ‰

License πŸ“

This project is licensed under the MIT License.


Contact βœ‰οΈ

For questions or support, please reach out via Issues.


⭐ If you find this project helpful, give it a star! ⭐