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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Amazigh Verb Conjugator</title>
|
7 |
+
<style>
|
8 |
+
body {
|
9 |
+
font-family: Arial, sans-serif;
|
10 |
+
max-width: 800px;
|
11 |
+
margin: 0 auto;
|
12 |
+
padding: 20px;
|
13 |
+
background-color: #f0f0f0;
|
14 |
+
}
|
15 |
+
h1 {
|
16 |
+
text-align: center;
|
17 |
+
color: #333;
|
18 |
+
}
|
19 |
+
.input-container {
|
20 |
+
display: flex;
|
21 |
+
justify-content: space-between;
|
22 |
+
margin-bottom: 20px;
|
23 |
+
}
|
24 |
+
input[type="text"] {
|
25 |
+
width: 22%;
|
26 |
+
padding: 10px;
|
27 |
+
font-size: 16px;
|
28 |
+
}
|
29 |
+
button {
|
30 |
+
display: block;
|
31 |
+
width: 100%;
|
32 |
+
padding: 10px;
|
33 |
+
font-size: 16px;
|
34 |
+
background-color: #4CAF50;
|
35 |
+
color: white;
|
36 |
+
border: none;
|
37 |
+
cursor: pointer;
|
38 |
+
margin-bottom: 20px;
|
39 |
+
}
|
40 |
+
button:hover {
|
41 |
+
background-color: #45a049;
|
42 |
+
}
|
43 |
+
table {
|
44 |
+
width: 100%;
|
45 |
+
border-collapse: collapse;
|
46 |
+
margin-bottom: 20px;
|
47 |
+
background-color: white;
|
48 |
+
}
|
49 |
+
th, td {
|
50 |
+
border: 1px solid #ddd;
|
51 |
+
padding: 10px;
|
52 |
+
text-align: left;
|
53 |
+
}
|
54 |
+
th {
|
55 |
+
background-color: #4CAF50;
|
56 |
+
color: white;
|
57 |
+
}
|
58 |
+
.highlight {
|
59 |
+
color: red;
|
60 |
+
font-weight: bold;
|
61 |
+
}
|
62 |
+
.export-buttons {
|
63 |
+
display: flex;
|
64 |
+
justify-content: space-between;
|
65 |
+
margin-top: 20px;
|
66 |
+
}
|
67 |
+
.export-buttons button {
|
68 |
+
width: 32%;
|
69 |
+
}
|
70 |
+
</style>
|
71 |
+
</head>
|
72 |
+
<body>
|
73 |
+
<h1>Amazigh Verb Conjugator</h1>
|
74 |
+
<div class="input-container">
|
75 |
+
<input type="text" id="urmirInput" placeholder="ⵓⵔⵎⵉⵔ">
|
76 |
+
<input type="text" id="usmidInput" placeholder="ⵓⵙⵎⵉⴷ">
|
77 |
+
<input type="text" id="usmidAnabawInput" placeholder="ⵓⵙⵎⵉⴷ ⴰⵏⴰⴱⴰⵡ">
|
78 |
+
<input type="text" id="arusmidInput" placeholder="ⴰⵔⵓⵙⵎⵉⴷ">
|
79 |
+
</div>
|
80 |
+
<button onclick="conjugateVerb()">ⵙⴼⵜⵉ</button>
|
81 |
+
<div id="results"></div>
|
82 |
+
<div class="export-buttons">
|
83 |
+
<button onclick="exportJSON()">Export JSON</button>
|
84 |
+
<button onclick="exportTXT()">Export TXT</button>
|
85 |
+
<button onclick="exportWordPerLine()">Export Word-per-line</button>
|
86 |
+
</div>
|
87 |
+
<div class="input-container">
|
88 |
+
Example: ⵓⵔⵎⵉⵔ:ⵖⵔ</br>ⵓⵙⵎⵉⴷ:ⵖⵔⵉ\ⵖⵔⴰ</br>ⵓⵙⵎⵉⴷ ⴰⵏⴰⴱⴰⵡ:ⵖⵔⵉ</br>ⴰⵔⵓⵙⵎⵉⴷ:ⴰⵇⵇⵔⴰ
|
89 |
+
</div>
|
90 |
+
<script>
|
91 |
+
const tenses = ['ⵓⵔⵎⵉⵔ (ⴰⴷ.., ⵔⴰⴷ..)', 'ⵓⵙⵎⵉⴷ (..ⵢⴰⴷ)', 'ⵓⵙⵎⵉⴷ ⴰⵏⴰⴱⴰⵡ (ⵓⵔ ⵢⴰⴷ..)', 'ⴰⵔⵓⵙⵎⵉⴷ (ⵔⴰⴷ.., ⴰⴷ..)', 'ⴰⵏⴰⴹ', 'ⴰⵏⴰⴹ ⵓⵙⵙⵉⴷ'];
|
92 |
+
const pronouns = [
|
93 |
+
['ⵏⴽⴽ', 'ⵏⴽⴽ'],
|
94 |
+
['ⴽⵢⵢ', 'ⴽⵎⵎ'],
|
95 |
+
['ⵏⵜⵜⴰ', 'ⵏⵜⵜⴰⵜ'],
|
96 |
+
['ⵏⴽⴽⵏⵉ', 'ⵏⴽⴽⵏⵜⵉ'],
|
97 |
+
['ⴽⵏⵏⵉ', 'ⴽⵏⵏⵉⵏⵜⵉ'],
|
98 |
+
['ⵏⵉⵜⵏⵉ', 'ⵏⵉⵜⵏⵜⵉ']
|
99 |
+
];
|
100 |
+
const anadPronouns = [
|
101 |
+
['ⴽⵢⵢ', 'ⴽⵎⵎ'],
|
102 |
+
['ⴽⵏⵏⵉ1', 'ⴽⵏⵏⵉⵏⵜⵉ1'],
|
103 |
+
['ⴽⵏⵏⵉ2', 'ⴽⵏⵏⵉⵏⵜⵉ2']
|
104 |
+
];
|
105 |
+
|
106 |
+
let conjugationResults = {};
|
107 |
+
|
108 |
+
function conjugateVerb() {
|
109 |
+
const urmirVerb = document.getElementById('urmirInput').value;
|
110 |
+
const usmidVerb = document.getElementById('usmidInput').value;
|
111 |
+
const usmidAnabawVerb = document.getElementById('usmidAnabawInput').value;
|
112 |
+
const arusmidVerb = document.getElementById('arusmidInput').value;
|
113 |
+
|
114 |
+
let results = '';
|
115 |
+
conjugationResults = {};
|
116 |
+
|
117 |
+
tenses.forEach((tense, index) => {
|
118 |
+
let verb;
|
119 |
+
if (index === 0 || index === 4) {
|
120 |
+
verb = urmirVerb;
|
121 |
+
} else if (index === 1) {
|
122 |
+
verb = usmidVerb;
|
123 |
+
} else if (index === 2) {
|
124 |
+
verb = usmidAnabawVerb;
|
125 |
+
} else if (index === 3 || index === 5) {
|
126 |
+
verb = arusmidVerb;
|
127 |
+
}
|
128 |
+
|
129 |
+
results += `<h2>${tense}</h2>`;
|
130 |
+
results += '<table>';
|
131 |
+
results += '<tr><th>ⴰⵎⴰⵢ</th><th>ⵓⵏⵜⵉ</th></tr>';
|
132 |
+
|
133 |
+
conjugationResults[tense] = {};
|
134 |
+
|
135 |
+
if (index === 4 || index === 5) {
|
136 |
+
anadPronouns.forEach(([male, female], idx) => {
|
137 |
+
const maleConjugation = conjugate(verb, male, tense, idx);
|
138 |
+
const femaleConjugation = conjugate(verb, female, tense, idx);
|
139 |
+
results += `<tr><td>${maleConjugation}</td><td>${femaleConjugation}</td></tr>`;
|
140 |
+
conjugationResults[tense][male] = maleConjugation;
|
141 |
+
conjugationResults[tense][female] = femaleConjugation;
|
142 |
+
});
|
143 |
+
} else {
|
144 |
+
pronouns.forEach(([male, female]) => {
|
145 |
+
const maleConjugation = conjugate(verb, male, tense);
|
146 |
+
const femaleConjugation = conjugate(verb, female, tense);
|
147 |
+
results += `<tr><td>${maleConjugation}</td><td>${femaleConjugation}</td></tr>`;
|
148 |
+
conjugationResults[tense][male] = maleConjugation;
|
149 |
+
conjugationResults[tense][female] = femaleConjugation;
|
150 |
+
});
|
151 |
+
}
|
152 |
+
|
153 |
+
results += '</table>';
|
154 |
+
});
|
155 |
+
|
156 |
+
document.getElementById('results').innerHTML = results;
|
157 |
+
}
|
158 |
+
|
159 |
+
function conjugate(verb, pronoun, tense, idx) {
|
160 |
+
if (!verb) return '';
|
161 |
+
|
162 |
+
let conjugated = '';
|
163 |
+
const [verbForm1, verbForm2] = verb.split('\\');
|
164 |
+
|
165 |
+
let verbToUse = verbForm1;
|
166 |
+
if (verbForm2 && !['ⵏⴽⴽ', 'ⴽⵢⵢ', 'ⴽⵎⵎ'].includes(pronoun)) {
|
167 |
+
verbToUse = verbForm2;
|
168 |
+
}
|
169 |
+
|
170 |
+
if (tense === 'ⴰⵏⴰⴹ' || tense === 'ⴰⵏⴰⴹ ⵓⵙⵙⵉⴷ') {
|
171 |
+
if (pronoun === 'ⵏⴽⴽ') {
|
172 |
+
conjugated = `${pronoun} ${verbToUse}`;
|
173 |
+
} else if (pronoun === 'ⴽⵢⵢ' || pronoun === 'ⴽⵎⵎ') {
|
174 |
+
conjugated = `${pronoun} <span>${verbToUse}</span>`;
|
175 |
+
} else if (pronoun === 'ⴽⵏⵏⵉ1' || pronoun === 'ⴽⵏⵏⵉⵏⵜⵉ1' || pronoun === 'ⴽⵏⵏⵉ2' || pronoun === 'ⴽⵏⵏⵉⵏⵜⵉ2') {
|
176 |
+
let suffix;
|
177 |
+
let ending = '';
|
178 |
+
if (idx === 1) { // First ⴽⵏⵏⵉ and ⴽⵏⵏⵉⵏⵜⵉ
|
179 |
+
suffix = pronoun.startsWith('ⴽⵏⵏⵉ1') ? 'ⵎ' : 'ⵎⵜ';
|
180 |
+
} else { // Second ⴽⵏⵏⵉ2 and ⴽⵏⵏⵉⵏⵜⵉ2
|
181 |
+
suffix = pronoun.startsWith('ⴽⵏⵏⵉ2') ? 'ⴰⵜ' : 'ⴰⵎⵜ';
|
182 |
+
ending = verbToUse.endsWith('ⴰ') ? 'ⵢ' : verbToUse.endsWith('ⵉ') ? 'ⵢ' : verbToUse.endsWith('ⵓ') ? 'ⵢ' : '';
|
183 |
+
}
|
184 |
+
conjugated = `${pronoun.replace(/[12]/, '')} ${verbToUse}${ending}<span class="highlight">${suffix}</span>`;
|
185 |
+
}
|
186 |
+
} else {
|
187 |
+
let prefix = '';
|
188 |
+
let suffix = '';
|
189 |
+
|
190 |
+
switch (pronoun) {
|
191 |
+
case 'ⵏⴽⴽ':
|
192 |
+
suffix = 'ⵖ';
|
193 |
+
break;
|
194 |
+
case 'ⴽⵢⵢ':
|
195 |
+
case 'ⴽⵎⵎ':
|
196 |
+
prefix = 'ⵜ';
|
197 |
+
suffix = 'ⴷ';
|
198 |
+
break;
|
199 |
+
case 'ⵏⵜⵜⴰ':
|
200 |
+
prefix = 'ⵉ';
|
201 |
+
break;
|
202 |
+
case 'ⵏⵜⵜⴰⵜ':
|
203 |
+
prefix = 'ⵜ';
|
204 |
+
break;
|
205 |
+
case 'ⵏⴽⴽⵏⵉ':
|
206 |
+
case 'ⵏⴽⴽⵏⵜⵉ':
|
207 |
+
prefix = 'ⵏ';
|
208 |
+
break;
|
209 |
+
case 'ⴽⵏⵏⵉ':
|
210 |
+
prefix = 'ⵜ';
|
211 |
+
suffix = 'ⵎ';
|
212 |
+
break;
|
213 |
+
case 'ⴽⵏⵏⵉⵏⵜⵉ':
|
214 |
+
prefix = 'ⵜ';
|
215 |
+
suffix = 'ⵎⵜ';
|
216 |
+
break;
|
217 |
+
case 'ⵏⵉⵜⵏⵉ':
|
218 |
+
suffix = 'ⵏ';
|
219 |
+
break;
|
220 |
+
case 'ⵏⵉⵜⵏⵜⵉ':
|
221 |
+
suffix = 'ⵏⵜ';
|
222 |
+
break;
|
223 |
+
}
|
224 |
+
|
225 |
+
if (prefix === 'ⵜ' && verbToUse.startsWith('ⵜⵜⴻ')) {
|
226 |
+
prefix = '';
|
227 |
+
} else if (prefix === 'ⵜ' && verbToUse.startsWith('ⵜⵜ')) {
|
228 |
+
prefix = 'ⵜⴻ';
|
229 |
+
} else if (prefix === 'ⵉ' && ['ⵉ', 'ⴰ', 'ⵓ'].includes(verbToUse[0])) {
|
230 |
+
prefix = 'ⵢ';
|
231 |
+
}
|
232 |
+
|
233 |
+
conjugated = `${pronoun} <span class="highlight">${prefix}</span>${verbToUse}<span class="highlight">${suffix}</span>`;
|
234 |
+
|
235 |
+
// Apply the ⵜⴻⵜⵜⴻⵜⵜ- -> ⵜⵜⴻⵜⵜ- correction
|
236 |
+
conjugated = conjugated.replace(/ⵜⴻⵜⵜⴻⵜⵜ/g, 'ⵜⵜⴻⵜⵜ');
|
237 |
+
}
|
238 |
+
|
239 |
+
return conjugated;
|
240 |
+
}
|
241 |
+
|
242 |
+
function extractConjugatedWord(htmlString) {
|
243 |
+
// Remove the pronoun part (everything before the first space)
|
244 |
+
const withoutPronoun = htmlString.substring(htmlString.indexOf(' ') + 1);
|
245 |
+
|
246 |
+
// Remove HTML tags and trim
|
247 |
+
return withoutPronoun.replace(/<[^>]+>/g, '').trim();
|
248 |
+
}
|
249 |
+
|
250 |
+
function exportJSON() {
|
251 |
+
const jsonString = JSON.stringify(conjugationResults, null, 2);
|
252 |
+
const blob = new Blob([jsonString], { type: 'application/json' });
|
253 |
+
const url = URL.createObjectURL(blob);
|
254 |
+
const a = document.createElement('a');
|
255 |
+
a.href = url;
|
256 |
+
a.download = 'amazigh_conjugations.json';
|
257 |
+
document.body.appendChild(a);
|
258 |
+
a.click();
|
259 |
+
document.body.removeChild(a);
|
260 |
+
URL.revokeObjectURL(url);
|
261 |
+
}
|
262 |
+
|
263 |
+
function exportTXT() {
|
264 |
+
let txtContent = '';
|
265 |
+
for (const [tense, pronouns] of Object.entries(conjugationResults)) {
|
266 |
+
txtContent += `${tense}\n`;
|
267 |
+
txtContent += '------------------------\n';
|
268 |
+
for (const [pronoun, conjugation] of Object.entries(pronouns)) {
|
269 |
+
txtContent += `${pronoun}: ${conjugation.replace(/<[^>]+>/g, '')}\n`;
|
270 |
+
}
|
271 |
+
txtContent += '\n';
|
272 |
+
}
|
273 |
+
const blob = new Blob([txtContent], { type: 'text/plain' });
|
274 |
+
const url = URL.createObjectURL(blob);
|
275 |
+
const a = document.createElement('a');
|
276 |
+
a.href = url;
|
277 |
+
a.download = 'amazigh_conjugations.txt';
|
278 |
+
document.body.appendChild(a);
|
279 |
+
a.click();
|
280 |
+
document.body.removeChild(a);
|
281 |
+
URL.revokeObjectURL(url);
|
282 |
+
}
|
283 |
+
|
284 |
+
function exportWordPerLine() {
|
285 |
+
let wordPerLineContent = '';
|
286 |
+
for (const [tense, pronouns] of Object.entries(conjugationResults)) {
|
287 |
+
for (const conjugation of Object.values(pronouns)) {
|
288 |
+
// Extract just the conjugated word without the pronoun
|
289 |
+
const word = extractConjugatedWord(conjugation);
|
290 |
+
if (word) {
|
291 |
+
wordPerLineContent += `${word}\n`;
|
292 |
+
}
|
293 |
+
}
|
294 |
+
}
|
295 |
+
const blob = new Blob([wordPerLineContent], { type: 'text/plain' });
|
296 |
+
const url = URL.createObjectURL(blob);
|
297 |
+
const a = document.createElement('a');
|
298 |
+
a.href = url;
|
299 |
+
a.download = 'amazigh_conjugations_word_per_line.txt';
|
300 |
+
document.body.appendChild(a);
|
301 |
+
a.click();
|
302 |
+
document.body.removeChild(a);
|
303 |
+
URL.revokeObjectURL(url);
|
304 |
+
}
|
305 |
+
</script>
|
306 |
+
</body>
|
307 |
+
</html>
|