/freedictionaryapi

free dictionary api

Primary LanguageJavaScriptMIT LicenseMIT

Welcome to freedictionaryapi 👋

Version Documentation Maintenance License: MIT Twitter: ngocsangyem

Inspired by freeDictionaryAPI

Demo

Introduction

  • More than 700k+ Definitions of word
  • freedictionaryapi base on open source Wiktionary.
  • It is a simple and easy to use API to get the definition of a word.
  • It is a free and open source project.

Development

npm install
npm start

Usage

Definitions

https://api.freedictionary.dev/api/{version}/entries/en/{word}

Type Definitions

interface IPhonetic {
 ipa: string;
 audio: string;
 type: string;
}

interface IForm {
 text: string;
 type: string;
}

interface IAntonym {
 text: string;
 meaning: string
}

interface ISynonym {
 text: string;
 meaning: string
}

interface IMeaning {
 definition: string;
 examples: string[]
 antonyms?: IAntonym[] | null;
 synonyms?: ISynonym[] | null;
}

interface IWord {
 word: string;
 partOfSpeech: string;
 phonetics?: IPhonetic[];
 meanings: IMeaning[];
 forms?: IForm[];
}

Example

https://api.freedictionary.dev/api/v1/entries/en/go

You will get result

[
    {
        "word":"go",
        "partOfSpeech":"verb",
        "phonetics":[
            {
                "type":"uk",
                "audio":"https://upload.wikimedia.org/wikipedia/commons/transcoded/e/ef/En-uk-to_go.ogg/En-uk-to_go.ogg.mp3",
                "ipa":"/ɡəʊ/"
            },
            {
                "type":"us",
                "audio":"https://upload.wikimedia.org/wikipedia/commons/transcoded/0/0a/En-us-go.ogg/En-us-go.ogg.mp3",
                "ipa":"/ɡoʊ/"
            }
        ],
        "forms":[
            {
                "text":"goes",
                "type":"present singular third-person"
            },
            {
                "text":"going",
                "type":"participle present"
            },
            {
                "text":"went",
                "type":"past"
            }
        ],
        "meanings":[
            {
                "definition":"To move through space (especially to or through a place). (May be used of tangible things like people or cars, or intangible things like moods or information.)",
                "examples":[
                    "She was so mad she wouldn't speak to me for quite a spell, but at last I coaxed her into going up to Miss Emmeline's room and fetching down a tintype of the missing Deacon man.",
                ],
                "antonyms":[
                    {
                        "text":"freeze",
                        "meaning":""
                    },
                    {
                        "text":"halt",
                        "meaning":""
                    }
                ],
                "synonyms":[
                    {
                        "text":"move",
                        "meaning":""
                    },
                    {
                        "text":"fare",
                        "meaning":""
                    }
                ]
            }
        ]
    }
]

Pronunciation

https://api.freedictionary.dev/api/{version}/pronunciation/en/{word}

Type Definitions

interface IPhonetic {
 type: string;
 audio: string;
}

interface IPronunciation {
  word: string;
  phonetics: IPhonetic[];
}

Example

https://api.freedictionary.dev/api/v1/entries/en/go

You will get result

{
  "word": "go",
  "phonetics": [
    {
      "type": "uk",
      "audio": "https://dictionary.cambridge.org/media/english/uk_pron/u/ukg/ukglu/ukglutt024.mp3"
    },
    {
      "type": "us",
      "audio": "https://dictionary.cambridge.org/media/english/us_pron/g/go_/go___/go.mp3"
    },
    {
      "type": "uk",
      "audio": "https://dictionary.cambridge.org/media/english/uk_pron/u/ukg/ukglu/ukglutt024.mp3"
    },
    {
      "type": "us",
      "audio": "https://dictionary.cambridge.org/media/english/us_pron/g/go_/go___/go.mp3"
    }
  ]
}

Note

If you are using linguarobot, create .env and add linguarobot API key to it.

API_KEY=xxxxx

Todo

  • Performance query
  • Docs
  • Refactor code

Author

👤 ngocsangyem

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2022 ngocsangyem.
This project is MIT licensed.