React Native node module wrapper for Oxford Dictionary API. Inspired by oxford-dictionary
npm install react-native-oxford-dictionary
const Dictionary = require("react-native-oxford-dictionary");
const config = {
app_id : "YOUR_OXFORD_ACCOUNT_APP_ID",
app_key : "YOUR_OXFORD_ACCOUNT_APP_KEY",
source_lang : "en-us" // default: en-us
};
const dict = new Dictionary(config);
const define = dict.find("cool");
define.then((res) => {
// stringify JSON object to see full structure in console log
console.log(JSON.stringify(res, null, 4));
},
(err) => {
console.log(err);
});
Useful methods.
.find
retrieves available dictionary entries for a given word and language.
const define = dict.find("cool");
.definitions
retrieves available dictionary entries for given word and language and returns the definitions.
const define = dict.definitions("cool");
.inflections
retrieves available lemmas for a given inflected wordform.
const define = dict.inflections("cool");
.pronunciations
retrieves available dictionary entries for given word and language and returns the pronunciation.
const define = dict.pronunciations("cool");
.examples
retrieves available dictionary entries for given word and language and returns only examples.
const define = dict.examples("cool");
.synonyms
retrieves available synonyms for a given word and language.
const define = dict.synonyms("cool");
.antonyms
retrieves available antonyms for a given word and language.
const define = dict.antonyms("cool");
.sentences
retrieves list of sentences and list of senses (English language only).
const define = dict.sentences("cool");