UNPKG

eld-custom

Version:

Fast and accurate natural language detection. Detector written in Javascript. Efficient language detector, Nito-ELD, ELD.

23 lines (20 loc) 701 B
export interface LanguageResult { language: string; getScores(): Record<string, number>; isReliable(): boolean; } export interface Eld { /** * Detects the natural language of a UTF-8 string * @param text - UTF-8 string to analyze * @returns LanguageResult object containing detected language and methods */ detect(text: string): LanguageResult; /** * Initialize the language detector by loading ngrams * @param ngramFile - The ngram file to load (default: "ngramsM60-subset-de-en-es-fr-it-ja-ko-pt-zh.js") * @returns Promise that resolves to true when initialization is complete */ init(ngramFile?: string): Promise<boolean>; } export declare const eld: Eld;