This library gives you access to French words data by scraping them from the dictionary Le Robert, one of the most famous French dictionaries, using Puppeteer.
npm install le-robert
yarn add le-robert
pnpm add le-robert
Each function can be imported from the library as below 👇
// Require syntax
const { getDefinitionGroups, getPronunciation, ... } = require('le-robert');
// Import syntax
import { getDefinitionGroups, getPronunciation, ... } from 'le-robert';
await getDefinitionGroups('programmation'); // => https://sourceb.in/4rSVNnS0rQ
await getPronunciation('programmation'); // => https://sourceb.in/5rHNNIWFZD
await getUsageExamples('programmation'); // => https://sourceb.in/IekuY8L8Jp
await getConjugationGroups('programmer'); // => https://sourceb.in/HZccVYUGzJ
Since some of the returned objects from the previous functions may be huge, here is the types to help you understand better how to use the data.
Also, you can use the intellisense of your editor to explore the data.
interface DefinitionGroup {
category: string;
definitions: Definition[];
}
interface Definition {
value: string;
examples: string[];
context?: string;
}
interface Pronunciation {
audioURL: string;
}
interface UsageExample {
value: string;
source: UsageExampleSource;
}
interface UsageExampleSource {
value: string;
url: string;
}
interface ConjugationGroup {
name: string;
subgroups: ConjugationSubgroup[];
}
interface ConjugationSubgroup {
name: string;
tenses: ConjugationTense[];
}
interface ConjugationTense {
name: string;
conjugations: string[];
}