UNPKG

wordreference

Version:

A Node solution for retrieving wordreference translations

33 lines (32 loc) 1.04 kB
import { Cheerio, Element } from 'cheerio'; import { WRDictionary, WRDictionaryKey } from './dictionaries'; export type Parity = 'odd' | 'even'; export interface Word { word: string; pos: string; sense?: string; } export interface Example { phrase?: string; translations?: string[]; } export interface Translation { word: Word; definition: string; note?: string; meanings: Word[]; examples: Example[]; } export interface Section { title: string; translations: Translation[]; } export interface WRTranslation { inputWord: string; sections: Section[]; audioLinks: string[]; } export declare const isEmptyWord: (word: Word) => boolean; export declare const deltaParity: ($row: Cheerio<Element>, lastRowSelector: Parity | null, onChange: (rowSelector: Parity) => void) => void; export declare const formRequestURL: (dictionary: WRDictionaryKey, word: string) => string; export declare const defineWord: (word: string, dictionary: WRDictionaryKey | WRDictionary) => Promise<WRTranslation>;