barisaksu / googleDictionaryAPI

Google does not provide Google Dictionary API so I created one.

Home Page:https://dictionaryapi.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Dictionary API

Google does not provide Google Dictionary API so I created one.

Getting Started

Usage

The basic syntax of a URL request to the API is shown below:

https://api.dictionaryapi.dev/api/<--version-->/entries/<--language_code-->/<--word-->

As an example, to get definition of English word hello using v2, you can send request to

https://api.dictionaryapi.dev/api/v2/entries/en_US/hello, result returned will be,

[
    {
        "word": "hello",
        "phonetics": [
            {
                "text": "/həˈloʊ/",
                "audio": "https://lex-audio.useremarkable.com/mp3/hello_us_1_rr.mp3"
            },
            {
                "text": "/hɛˈloʊ/",
                "audio": "https://lex-audio.useremarkable.com/mp3/hello_us_2_rr.mp3"
            }
        ],
        "meanings": [
            {
                "partOfSpeech": "exclamation",
                "definitions": [
                    {
                        "definition": "Used as a greeting or to begin a phone conversation.",
                        "example": "hello there, Katie!"
                    }
                ]
            },
            {
                "partOfSpeech": "noun",
                "definitions": [
                    {
                        "definition": "An utterance of “hello”; a greeting.",
                        "example": "she was getting polite nods and hellos from people",
                        "synonyms": [
                            "greeting",
                            "welcome",
                            "salutation",
                            "saluting",
                            "hailing",
                            "address",
                            "hello",
                            "hallo"
                        ]
                    }
                ]
            },
            {
                "partOfSpeech": "intransitive verb",
                "definitions": [
                    {
                        "definition": "Say or shout “hello”; greet someone.",
                        "example": "I pressed the phone button and helloed"
                    }
                ]
            }
        ]
    }
]

Language support

The API supports multiple language, you can query any language supported by sending its language code.

For example you can get definition of French word Bonjour in v2 format by sending request to,

https://api.dictionaryapi.dev/api/v2/entries/fr/bonjour

[
    {
        "word": "bonjour",
        "phonetics": [
            {}
        ],
        "meanings": [
            {
                "partOfSpeech": "nom masculin",
                "definitions": [
                    {
                        "definition": "Souhait de bonne journée (adressé en arrivant, en rencontrant).",
                        "synonyms": [
                            "salut"
                        ],
                        "antonyms": []
                    }
                ]
            }
        ]
    }
]

List of languages supported can be found here for your reference.

Regarding V1 Version

The API earlier use to send response as shown below, but this structure of response was found out to be difficult to work with (you can take a look at these tickets #32 and #4), based on feedback in these tickets I have updated the API to v2 version. v2 version is available for all languages supported. That said, v1 version will always be supported for backward compatibility.

[
    {
        "word": "hello",
        "phonetics": [
            {
                "text": "/həˈloʊ/",
                "audio": "https://lex-audio.useremarkable.com/mp3/hello_us_1_rr.mp3"
            },
            {
                "text": "/hɛˈloʊ/",
                "audio": "https://lex-audio.useremarkable.com/mp3/hello_us_2_rr.mp3"
            }
        ],
        "meaning": {
            "exclamation": [
                {
                    "definition": "Used as a greeting or to begin a phone conversation.",
                    "example": "hello there, Katie!"
                }
            ],
            "noun": [
                {
                    "definition": "An utterance of “hello”; a greeting.",
                    "example": "she was getting polite nods and hellos from people",
                    "synonyms": [
                        "greeting",
                        "welcome",
                        "salutation",
                        "saluting",
                        "hailing",
                        "address",
                        "hello",
                        "hallo"
                    ]
                }
            ],
            "intransitive verb": [
                {
                    "definition": "Say or shout “hello”; greet someone.",
                    "example": "I pressed the phone button and helloed"
                }
            ]
        }
    }
]

Paths

Location Endpoint
Root path https://api.dictionaryapi.dev/api/<--version-->

HTTP request and query methods

Method Endpoint Description Examples
GET /entries/<LANGUAGE>/<YOUR_WORD> Retrieves the Google Dictionary definition of the given word that has been entered instead of <YOUR_WORD> in the provided language <LANGUAGE>. /api/v2/entries/fr/bonjour

Future plans

You can see existing and add new feature proposals on the projects GitHub page. Pull requests are welcome!

If you need any assistance or find any bugs, feel free to contact me directly via email or create a new issue on the GitHub page.

Support Us

This Dictionary API was initially created as an API that could be used by my friend for his project. I did not in my wildest dream thought that this API will become so popular, in few months this API took off and many people started to use it, initially I was able to manage the server costs but as number of requests started increasing, so did the server costs. Currently API has more than 10 million requests per month and to keep it running I need support of the community. I have planned few things in near future that will bring the cost down, but that will take some time.

Kindly help me keep running and developing this API. Thanks a lot for using my API, it feels good when your creation help other create their own projects.

paypal

Related Projects

Dictionary Anywhere

The Dictionary Anywhere extension helps you stay focused on what you are reading by eliminating the need to search for meaning, Double-clicking any word will view its definition in a small pop-up bubble. Now you never have to leave what you are reading to search for the meaning of the words you don't yet know.

Extension is available for Google Chrome and Mozilla Firefox.

Enjoy Reading Uninterrupted!!!

About

Google does not provide Google Dictionary API so I created one.

https://dictionaryapi.dev/

License:GNU General Public License v3.0


Languages

Language:JavaScript 46.3%Language:HTML 41.8%Language:CSS 11.9%