📕 Le Robert
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.
📥 Installation
NPM
npm install le-robert
Yarn
yarn add le-robert
PNPM
pnpm add le-robert
🔧 Functions
Each function can be imported from the library as below 👇
const { getDefinitionGroups, getPronunciation, ... } = require('le-robert');
import { getDefinitionGroups, getPronunciation, ... } from 'le-robert';
getDefinitionGroups(wordQuery: string): Promise<DefinitionGroup[]>
Example
await getDefinitionGroups('programmation');
getPronunciation(wordQuery: string): Promise<Pronunciation>
Example
await getPronunciation('programmation');
getUsageExamples(wordQuery: string): Promise<UsageExample[]>
Example
await getUsageExamples('programmation');
getConjugationGroups(verbQuery: string): Promise<ConjugationGroup[]>
Example
await getConjugationGroups('programmer');
⚙️ Types
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.
DefinitionGroup
interface DefinitionGroup {
category: string;
definitions: Definition[];
}
Definition
interface Definition {
value: string;
examples: string[];
context?: string;
}
Pronunciation
interface Pronunciation {
audioURL: string;
}
UsageExample
interface UsageExample {
value: string;
source: UsageExampleSource;
}
UsageExampleSource
interface UsageExampleSource {
value: string;
url: string;
}
ConjugationGroup
interface ConjugationGroup {
name: string;
subgroups: ConjugationSubgroup[];
}
ConjugationSubgroup
interface ConjugationSubgroup {
name: string;
tenses: ConjugationTense[];
}
ConjugationTense
interface ConjugationTense {
name: string;
conjugations: string[];
}