forked from FGRibreau/node-language-detect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
59 lines (53 loc) · 1.61 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
declare module 'languagedetect' {
type Probabilities = [ string, number ];
/**
* LanguageDetect is a port of the PEAR::Text_LanguageDetect that can
* identify human languages from text samples and return confidence
* scores for each.
*/
class LanguageDetect {
/**
* No parameters required
*/
constructor();
/**
* Detects the closeness of a sample of text to the known languages
*
* @param sample The text to run the detection
* @param limit Max number of matches
* @example
* detect('This is a test');
* @returns All sorted matches language with its matching score
*/
detect(sample: string, limit?: number): Probabilities[];
/**
* List of detectable languages
*
* @example
* getLanguages();
* @returns All supported languages
*/
getLanguages(): string[];
/**
* Number of languages that the lib can detect
*
* @example
* getLanguageCount();
* @returns How many languages are supported
*/
getLanguageCount(): number;
/**
* Set the language format to be used in the results
*
* Supported types are 'iso2' and 'iso3'. Any other
* value will result in the full language name being
* used (default).
*
* @example
* setLanguageType('iso2');
* @param languageType
*/
setLanguageType(languageType: string): void;
}
export = LanguageDetect;
}