1
|
|
2
|
const codeToWordclass = {
|
3
|
"N": "substantivum",
|
4
|
"A": "adjektivum",
|
5
|
"P": "pronomen",
|
6
|
"C": "numerále",
|
7
|
"V": "verbum",
|
8
|
"D": "adverbium",
|
9
|
"R": "prepozice",
|
10
|
"J": "konjunkce",
|
11
|
"I": "interjekce",
|
12
|
"T": "partikule"
|
13
|
};
|
14
|
|
15
|
const wordclassToNum = {
|
16
|
"N": 0,
|
17
|
"A": 1,
|
18
|
"P": 2,
|
19
|
"C": 3,
|
20
|
"V": 4,
|
21
|
"D": 5,
|
22
|
"R": 6,
|
23
|
"J": 7,
|
24
|
"I": 8,
|
25
|
"T": 9
|
26
|
};
|
27
|
|
28
|
const codeToManuscript = {
|
29
|
"0": "rukopis Vídeňský",
|
30
|
"1": "zlomky Hanušovy",
|
31
|
"2": "zlomky Hradecké",
|
32
|
"3": "rukopis Cambridžský",
|
33
|
"4": "rukopis Františkánský",
|
34
|
"5": "zlomek Olomoucký",
|
35
|
"6": "fragment Strahovský",
|
36
|
"7": "zlomky Klementinsko-Křižovnické",
|
37
|
"8": "zlomky Mnichovské",
|
38
|
"9": "rukopis Lobkovický",
|
39
|
"10": "rukopis Pelclův",
|
40
|
"11": "rukopis Cerronský",
|
41
|
"12": "rukopis Fürstenberský",
|
42
|
"13": "rukopis Zebererův",
|
43
|
"14": "vydání Pavla Ješína z Bezdězi, Praha 1620",
|
44
|
"15": "básně připsané při Pulkavově kronice v rukopisu Litoměřickém",
|
45
|
};
|
46
|
|
47
|
const codeToManuscriptShort = {
|
48
|
"0": "V",
|
49
|
"1": "H",
|
50
|
"2": "Hr",
|
51
|
"3": "C",
|
52
|
"4": "F",
|
53
|
"5": "O",
|
54
|
"6": "S",
|
55
|
"7": "K",
|
56
|
"8": "M",
|
57
|
"9": "L",
|
58
|
"10": "P",
|
59
|
"11": "Cr",
|
60
|
"12": "Fs",
|
61
|
"13": "Z",
|
62
|
"14": "Jš",
|
63
|
"15": "Pl",
|
64
|
};
|
65
|
|
66
|
const codeToCase = {
|
67
|
"1": "nominativ",
|
68
|
"2": "genitiv",
|
69
|
"3": "dativ",
|
70
|
"4": "akuzativ",
|
71
|
"5": "vokativ",
|
72
|
"6": "lokál",
|
73
|
"7": "instrumentál"
|
74
|
};
|
75
|
|
76
|
const codeToCountability = {
|
77
|
"S": "singulár",
|
78
|
"P": "plurál",
|
79
|
"D": "duál"
|
80
|
};
|
81
|
|
82
|
const codeToGender = {
|
83
|
"M": "maskulinum",
|
84
|
"F": "femininum",
|
85
|
"N": "neutrum"
|
86
|
};
|
87
|
|
88
|
const codeToGrade = {
|
89
|
"1": "pozitiv",
|
90
|
"2": "komparativ",
|
91
|
"3": "superlativ"
|
92
|
};
|
93
|
|
94
|
const codeToKType = {
|
95
|
"V": "větná",
|
96
|
"C": "členská",
|
97
|
"N": "navazovací",
|
98
|
"P": "spojení s přechodníkem"
|
99
|
};
|
100
|
|
101
|
const codeToShape = {
|
102
|
"C": "složený",
|
103
|
"N": "jmenný"
|
104
|
};
|
105
|
|
106
|
const codeToVid = {
|
107
|
"P": "perfektivum",
|
108
|
"I": "imperfektivum",
|
109
|
};
|
110
|
|
111
|
const codeToVType = {
|
112
|
"A": "aktivum",
|
113
|
"P": "pasivum",
|
114
|
};
|
115
|
|
116
|
const codeToTime= {
|
117
|
"P": "prézens",
|
118
|
"A": "aorist",
|
119
|
"R": "préteritum",
|
120
|
"I": "imperfektum",
|
121
|
"H": "plusquamperfektum",
|
122
|
"F": "futurum"
|
123
|
};
|
124
|
|
125
|
const codeToType = {
|
126
|
"P": "posesivum",
|
127
|
"S": "personale",
|
128
|
"D": "demonstrativum",
|
129
|
"Q": "interogativum",
|
130
|
"J": "relativum",
|
131
|
"Z": "indefinitum",
|
132
|
"L": "limitativum",
|
133
|
"W": "negativum",
|
134
|
};
|
135
|
|
136
|
const codeToMood = {
|
137
|
"d": "indikativ",
|
138
|
"i": "imperativ",
|
139
|
"c": "kondicionál"
|
140
|
};
|
141
|
|
142
|
const codeToIrregular = {
|
143
|
"f": "infinitiv",
|
144
|
"S": "supinum",
|
145
|
"e": "přech. přítomný",
|
146
|
"m": "přech. minulý",
|
147
|
"A": "part. perf. akt.",
|
148
|
"P": "part. perf. akt."
|
149
|
};
|
150
|
|
151
|
function convertDate(date) {
|
152
|
let newDate = "";
|
153
|
date = date.replace(" 00:00:00", "");
|
154
|
let splitDate = date.split("-");
|
155
|
|
156
|
newDate += splitDate[2] + ". " + splitDate[1] + ". " + splitDate[0];
|
157
|
return newDate;
|
158
|
}
|
159
|
|
160
|
function renderManuscript(manuscripts, shorten=true) {
|
161
|
let output = "";
|
162
|
for(let i = 0; i < manuscripts.length; i++){
|
163
|
if(shorten)
|
164
|
output += ("<span title=\""+ codeToManuscript[manuscripts[i]] +"\">" + codeToManuscriptShort[manuscripts[i]] + "</span>");
|
165
|
else
|
166
|
output += codeToManuscript[manuscripts[i]];
|
167
|
|
168
|
if(i < manuscripts.length - 1){
|
169
|
if(shorten)
|
170
|
output += ", ";
|
171
|
else
|
172
|
output += "; ";
|
173
|
}
|
174
|
}
|
175
|
return output;
|
176
|
}
|
177
|
|
178
|
function renderTag(tag) {
|
179
|
let output = "";
|
180
|
|
181
|
output += ((codeToWordclass.hasOwnProperty(tag[0])) ? ("<span title=\"" + codeToWordclass[tag[0]] + "\">" + tag[0] + "</span>") : ("<span>" + tag[0] + "</span>"));
|
182
|
output += ((codeToCase.hasOwnProperty(tag[1])) ? ("<span title=\"" + codeToCase[tag[1]] + "\">" + tag[1] + "</span>") : ("<span>" + tag[1] + "</span>"));
|
183
|
output += ((codeToCountability.hasOwnProperty(tag[2])) ? ("<span title=\"" + codeToCountability[tag[2]] + "\">" + tag[2] + "</span>") : ("<span>" + tag[2] + "</span>"));
|
184
|
output += ((codeToGender.hasOwnProperty(tag[3])) ? ("<span title=\"" + codeToGender[tag[3]] + "\">" + tag[3] + "</span>") : ("<span>" + tag[3] + "</span>"));
|
185
|
output += ((codeToGrade.hasOwnProperty(tag[4])) ? ("<span title=\"" + codeToGrade[tag[4]] + "\">" + tag[4] + "</span>") : ("<span>" + tag[4] + "</span>"));
|
186
|
output += ((codeToShape.hasOwnProperty(tag[5])) ? ("<span title=\"" + codeToShape[tag[5]] + "\">" + tag[5] + "</span>") : ("<span>" + tag[5] + "</span>"));
|
187
|
output += ("<span>" + tag[6] + "</span>");
|
188
|
|
189
|
if(tag[0] === "P"){
|
190
|
output += ((codeToType.hasOwnProperty(tag[7])) ? ("<span title=\""+ codeToType[tag[7]] +"\">" + tag[7] + "</span>") : ("<span>" + tag[7] + "</span>"));
|
191
|
} else if(tag[0] === "V"){
|
192
|
if(codeToMood.hasOwnProperty(tag[7])){
|
193
|
output += ("<span title=\""+ codeToMood[tag[7]] +"\">" + tag[7] + "</span>");
|
194
|
} else if(codeToIrregular.hasOwnProperty(tag[7])){
|
195
|
output += ("<span title=\""+ codeToIrregular[tag[7]] +"\">" + tag[7] + "</span>");
|
196
|
} else {
|
197
|
output += "<span>" + tag[7] + "</span>";
|
198
|
}
|
199
|
} else if(tag[0] === "J"){
|
200
|
output += ((codeToKType.hasOwnProperty(tag[7])) ? ("<span title=\""+ codeToKType[tag[7]] +"\">" + tag[7] + "</span>") : ("<span>" + tag[7] + "</span>"));
|
201
|
} else {
|
202
|
output += "<span>" + tag[7] + "</span>";
|
203
|
}
|
204
|
|
205
|
output += ((tag[8] !== "-") ? ("<span title=\""+ tag[8] +". osoba\">" + tag[8] + "</span>") : ("<span>" + tag[8] + "</span>"));
|
206
|
output += ((codeToTime.hasOwnProperty(tag[9])) ? ("<span title=\""+ codeToTime[tag[9]] +"\">" + tag[9] + "</span>") : ("<span>" + tag[9] + "</span>"));
|
207
|
output += ((codeToVType.hasOwnProperty(tag[10])) ? ("<span title=\""+ codeToVType[tag[10]] +"\">" + tag[10] + "</span>") : ("<span>" + tag[10] + "</span>"));
|
208
|
output += ((codeToVid.hasOwnProperty(tag[11])) ? ("<span title=\""+ codeToVid[tag[11]] +"\">" + tag[11] + "</span>") : ("<span>" + tag[11] + "</span>"));
|
209
|
|
210
|
return output;
|
211
|
}
|
212
|
|
213
|
function normalizeDescription(text){
|
214
|
console.log(text.toLowerCase());
|
215
|
if(text.toLowerCase().trim().startsWith("\\n")){
|
216
|
console.log("0");
|
217
|
text = text.replace("\\N", "-");
|
218
|
text = text.replace("\\n", "-");
|
219
|
} else {
|
220
|
console.log("1");
|
221
|
text = text.replace("\\N", "; ");
|
222
|
text = text.replace("\\n", "; ");
|
223
|
}
|
224
|
console.log(text);
|
225
|
return text;
|
226
|
}
|
227
|
|
228
|
function getCurrentDatum(){
|
229
|
const date = new Date();
|
230
|
const dd = String(date.getDate()).padStart(2, '0');
|
231
|
const mm = String(date.getMonth() + 1).padStart(2, '0'); //January is 0!
|
232
|
const yyyy = date.getFullYear();
|
233
|
|
234
|
const today = dd + ". " + mm +". " + yyyy;
|
235
|
return today;
|
236
|
}
|