le-robert
v1.0.1
Published
A library to scrape data from the French dictionary Le Robert
Downloads
5
Maintainers
Readme
📕 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 👇
// Require syntax
const { getDefinitionGroups, getPronunciation, ... } = require('le-robert');
// Import syntax
import { getDefinitionGroups, getPronunciation, ... } from 'le-robert';
getDefinitionGroups(wordQuery: string): Promise<DefinitionGroup[]>
Example
await getDefinitionGroups('programmation'); // => https://sourceb.in/4rSVNnS0rQ
getPronunciation(wordQuery: string): Promise<Pronunciation>
Example
await getPronunciation('programmation'); // => https://sourceb.in/5rHNNIWFZD
getUsageExamples(wordQuery: string): Promise<UsageExample[]>
Example
await getUsageExamples('programmation'); // => https://sourceb.in/IekuY8L8Jp
getConjugationGroups(verbQuery: string): Promise<ConjugationGroup[]>
Example
await getConjugationGroups('programmer'); // => https://sourceb.in/HZccVYUGzJ
⚙️ 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[];
}