/** * Language estimation. * * Deliberately small and dependency free. This is an estimate used for stratified sampling and for * reporting metrics per language, never for a classification decision. A wrong guess costs a * slightly skewed sample, nothing more, which is why a stopword scorer is preferred over pulling in * a model. * * Two stages: script detection first, because a Cyrillic or CJK body is unambiguous and cheap to * spot, then stopword frequency for Latin script languages. */ export type LanguageCode = 'en' | 'et' | 'de' | 'fr' | 'es' | 'it' | 'pt' | 'nl' | 'sv' | 'fi' | 'pl' | 'ru' | 'zh' | 'ja' | 'ko' | 'ar' | 'el' | 'he' | 'unknown'; export interface LanguageEstimate { lang: LanguageCode; /** Share of sampled tokens that matched the winning language's stopword list. */ score: number; } /** * Estimate the language of a body of text. * * @param text plain text. Only the first 20k characters are inspected, which is ample and keeps the * cost bounded on newsletters and digests. */ export declare function estimateLanguage(text: string): LanguageEstimate; //# sourceMappingURL=lang.d.ts.map