-
-
Notifications
You must be signed in to change notification settings - Fork 172
/
index.d.ts
145 lines (137 loc) · 4 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
declare module "react-native-tesseract-ocr" {
export const LANG_AFRIKAANS = "afr";
export const LANG_AMHARIC = "amh";
export const LANG_ARABIC = "ara";
export const LANG_ASSAMESE = "asm";
export const LANG_AZERBAIJANI = "aze";
export const LANG_BELARUSIAN = "bel";
export const LANG_BOSNIAN = "bos";
export const LANG_BULGARIAN = "bul";
export const LANG_CHINESE_SIMPLIFIED = "chi_sim";
export const LANG_CHINESE_TRADITIONAL = "chi_tra";
export const LANG_CROATIAN = "hrv";
export const LANG_CUSTOM = "custom";
export const LANG_DANISH = "dan";
export const LANG_ENGLISH = "eng";
export const LANG_ESTONIAN = "est";
export const LANG_FRENCH = "fra";
export const LANG_GALICIAN = "glg";
export const LANG_GERMAN = "deu";
export const LANG_HEBREW = "heb";
export const LANG_HUNGARIAN = "hun";
export const LANG_ICELANDIC = "isl";
export const LANG_INDONESIAN = "ind";
export const LANG_IRISH = "gle";
export const LANG_ITALIAN = "ita";
export const LANG_JAPANESE = "jpn";
export const LANG_KOREAN = "kor";
export const LANG_LATIN = "lat";
export const LANG_LITHUANIAN = "lit";
export const LANG_NEPALI = "nep";
export const LANG_NORWEGIAN = "nor";
export const LANG_PERSIAN = "fas";
export const LANG_POLISH = "pol";
export const LANG_PORTUGUESE = "por";
export const LANG_RUSSIAN = "rus";
export const LANG_SERBIAN = "srp";
export const LANG_SLOVAK = "slk";
export const LANG_SPANISH = "spa";
export const LANG_SWEDISH = "swe";
export const LANG_TURKISH = "tur";
export const LANG_UKRAINIAN = "ukr";
export const LANG_VIETNAMESE = "vie";
export const LEVEL_BLOCK = "block";
export const LEVEL_LINE = "line";
export const LEVEL_PARAGRAPH = "paragraph";
export const LEVEL_SYMBOL = "symbol";
export const LEVEL_WORD = "word";
export type Lang =
| typeof LANG_AFRIKAANS
| typeof LANG_AMHARIC
| typeof LANG_ARABIC
| typeof LANG_ASSAMESE
| typeof LANG_AZERBAIJANI
| typeof LANG_BELARUSIAN
| typeof LANG_BOSNIAN
| typeof LANG_BULGARIAN
| typeof LANG_CHINESE_SIMPLIFIED
| typeof LANG_CHINESE_TRADITIONAL
| typeof LANG_CROATIAN
| typeof LANG_CUSTOM
| typeof LANG_DANISH
| typeof LANG_ENGLISH
| typeof LANG_ESTONIAN
| typeof LANG_FRENCH
| typeof LANG_GALICIAN
| typeof LANG_GERMAN
| typeof LANG_HEBREW
| typeof LANG_HUNGARIAN
| typeof LANG_ICELANDIC
| typeof LANG_INDONESIAN
| typeof LANG_IRISH
| typeof LANG_ITALIAN
| typeof LANG_JAPANESE
| typeof LANG_KOREAN
| typeof LANG_LATIN
| typeof LANG_LITHUANIAN
| typeof LANG_NEPALI
| typeof LANG_NORWEGIAN
| typeof LANG_PERSIAN
| typeof LANG_POLISH
| typeof LANG_PORTUGUESE
| typeof LANG_RUSSIAN
| typeof LANG_SERBIAN
| typeof LANG_SLOVAK
| typeof LANG_SPANISH
| typeof LANG_SWEDISH
| typeof LANG_TURKISH
| typeof LANG_UKRAINIAN
| typeof LANG_VIETNAMESE;
export type Level =
| typeof LEVEL_BLOCK
| typeof LEVEL_LINE
| typeof LEVEL_PARAGRAPH
| typeof LEVEL_SYMBOL
| typeof LEVEL_WORD;
export type Options = {
allowlist?: string;
denylist?: string;
level?: Level; // only required for recognizeTokens
};
export type Bounding = {
bottom: number;
left: number;
right: number;
top: number;
};
export type Token = {
token: string;
confidence: number;
bounding: Bounding;
};
export interface ITesseractOcrModule {
clear(): void;
recognize(
imageSource: string,
lang: Lang,
options?: Options
): Promise<string>;
recognizeTokens(
imageSource: string,
lang: Lang,
options?: Options
): Promise<string>;
stop(): Promise<Token[]>;
}
export type ProgressData = {
percent: number;
};
export type EventListener = (data: ProgressData) => void;
export type EventType = "onProgressChange";
export function useEventListener(
eventType: EventType,
listener: EventListener
): void;
const TesseractOcr: ITesseractOcrModule;
export default TesseractOcr;
}