forked from dachev/node-cld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
34 lines (32 loc) · 1.08 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
interface Language {
readonly name: string;
readonly code: string;
readonly percent: number;
readonly score: number;
}
interface Chunk {
readonly name: string;
readonly code: string;
readonly offset: number;
readonly bytes: number;
}
interface Options {
readonly isHTML?: boolean;
readonly languageHint?: string;
readonly encodingHint?: string;
readonly tldHint?: string;
readonly httpHint?: string;
}
interface DetectLanguage {
readonly reliable: boolean;
readonly textBytes: number;
readonly languages: Language[];
readonly chunks: Chunk[];
}
export const LANGUAGES: {[name: string]: string};
export const DETECTED_LANGUAGES: string[];
export const ENCODINGS: string[];
export declare function detect(text: string, options: Options, callback: (err: string, result: DetectLanguage) => void): void;
export declare function detect(text: string, callback: (err: string, result: DetectLanguage) => void): void;
export declare function detect(text: string, options: Options): Promise<DetectLanguage>;
export declare function detect(text: string): Promise<DetectLanguage>;