-
Notifications
You must be signed in to change notification settings - Fork 9
/
types.ts
148 lines (123 loc) · 3.42 KB
/
types.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
146
147
148
import * as TermBank from './node_modules/yomichan-dict-builder/src/types/yomitan/termbank';
import * as TagBank from './node_modules/yomichan-dict-builder/src/types/yomitan/tagbank';
import * as TermBankMeta from './node_modules/yomichan-dict-builder/src/types/yomitan/termbankmeta';
declare global {
// 3-tidy-up.js types:
type TidyEnv = {
source_iso: string,
target_iso: string,
kaikki_file: string,
tidy_folder: string,
}
type KaikkiLine = {
head_templates?: HeadTemplate[];
word?: string;
pos?: string;
etymology_number?: number;
sounds?: Sound[];
forms?: FormInfo[];
senses?: KaikkiSense[];
}
type HeadTemplate = {
name?: string;
args?: string[];
}
type Sound = {
ipa?: string|string[];
tags?: string[];
note?: string;
}
type FormInfo = {
form?: string;
tags?: string[];
}
type KaikkiSense = {
examples?: Example[];
glosses?: Glosses;
raw_glosses?: Glosses;
raw_gloss?: Glosses;
tags?: string[];
raw_tags?: string[];
form_of?: FormOf[];
}
type Example = {
text?: string;
type?: "example" | "quotation" | "quote";
english?: string;
roman?: string;
translation?: string;
}
type StandardizedExample = {
text: string;
translation?: string;
}
type Glosses = string | string[];
type FormOf = {
word?: string;
}
type GlossTree = Map<string, GlossBranch> ;
type GlossBranch = GlossTwig & {
get(key: '_tags'): string[] | undefined;
set(key: '_tags', value: string[]): GlossBranch;
} ;
type GlossTwig = Map<string, GlossTwig> & {
get(key: '_examples'): StandardizedExample[] | undefined;
set(key: '_examples', value: StandardizedExample[]): GlossTwig;
}
type TidySense = Omit<KaikkiSense, 'tags'> & {
tags: string[];
glossesArray: string[];
}
type LemmaDict = {
[word: string]: {
[reading: string]: {
[pos: string]: {
[etymology_number: string]: LemmaInfo
}
}
}
}
type LemmaInfo = {
ipa: IpaInfo[],
glossTree: GlossTree,
}
type IpaInfo = {
ipa: string,
tags: string[],
}
type SenseInfo = {
glosses: TermBank.DetailedDefinition[],
tags: string[],
examples: Example[],
}
type Lemma = string;
type Form = string;
type PoS = string;
type FormsMap = Map<Lemma, Map<Form, Map<PoS, string[]>>>;
type AutomatedForms = Map<Lemma, Map<Form, Map<PoS, Set<string>|string[]>>>;
type NestedObject = {
[key: string]: NestedObject | any;
}
// 4-make-yomitan.js types:
type MakeYomitanEnv = {
source_iso: string,
target_iso: string,
DEBUG_WORD?: string,
DICT_NAME: string,
tidy_folder: string,
temp_folder: string,
}
type CondensedFormEntries = [string, string, [string, string[]][]][];
type WhitelistedTag = [
shortTag: string,
category: string,
sortOrder: number,
longTag: string | string[], // if array, first element will be used, others are aliases
popularityScore: number,
]
}
export {
TermBank,
TagBank,
TermBankMeta
}