joermd commited on
Commit
dfb5957
·
verified ·
1 Parent(s): 1f458a4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +103 -72
index.html CHANGED
@@ -10,7 +10,7 @@
10
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
11
  <style>
12
  /* -------------------------------
13
- الحركات والتأثيرات
14
  ------------------------------- */
15
  @keyframes gradient {
16
  0% { background-position: 0% 50%; }
@@ -32,7 +32,7 @@
32
  }
33
 
34
  /* -------------------------------
35
- تنسيقات النص والتظليل (استخدام ألوان مميزة)
36
  ------------------------------- */
37
  .text-comparison { line-height: 1.8; white-space: pre-wrap; }
38
  .highlight-missing {
@@ -49,6 +49,13 @@
49
  border-radius: 3px;
50
  font-weight: bold;
51
  }
 
 
 
 
 
 
 
52
 
53
  /* -------------------------------
54
  تنسيق الفقرات وترقيمها
@@ -92,131 +99,131 @@
92
  <body class="bg-gradient-to-br from-gray-100 via-blue-100 to-indigo-100 min-h-screen">
93
  <div class="min-h-screen pb-12">
94
  <!-- رأس الصفحة -->
95
- <header class="bg-gradient-to-r from-indigo-700 via-purple-700 to-pink-700 animate-gradient text-white py-10 mb-10 shadow-xl">
96
  <div class="max-w-6xl mx-auto px-4 text-center">
97
- <h1 class="text-5xl font-bold mb-4 animate-scale">
98
  نظام المقارنة والتحليل المتقدم
99
  <i class="fas fa-chart-line icon"></i>
100
  </h1>
101
- <p class="text-xl opacity-90">
102
- تحليل دقيق لاكتشاف النصوص المفقودة والأرقام/التواريخ المختلفة
103
  </p>
104
  </div>
105
  </header>
106
 
107
  <!-- المحتوى الرئيسي -->
108
- <main class="max-w-6xl mx-auto px-4 space-y-8">
109
  <!-- قسم رفع الملفات -->
110
  <div class="card card-hover">
111
- <h2 class="text-2xl font-bold text-gray-800 border-b pb-3 mb-6">
112
  <i class="fas fa-file-upload icon text-indigo-600"></i> تحميل الملفات
113
  </h2>
114
- <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
115
  <!-- ملف المصدر -->
116
- <div class="group border-2 border-dashed border-indigo-300 rounded-xl p-8 text-center bg-indigo-50 hover:bg-indigo-100 transition-colors duration-300">
117
  <label class="cursor-pointer block upload-label">
118
  <input type="file" id="sourceFile" accept=".docx,.pdf" class="hidden">
119
- <span class="text-lg text-indigo-600 group-hover:text-indigo-700">ملف المصدر</span>
120
- <i class="fas fa-upload text-5xl text-indigo-500 mb-4"></i>
121
  </label>
122
  </div>
123
  <!-- ملف الهدف -->
124
- <div class="group border-2 border-dashed border-pink-300 rounded-xl p-8 text-center bg-pink-50 hover:bg-pink-100 transition-colors duration-300">
125
  <label class="cursor-pointer block upload-label">
126
  <input type="file" id="targetFile" accept=".docx,.pdf" class="hidden">
127
- <span class="text-lg text-pink-600 group-hover:text-pink-700">ملف الهدف</span>
128
- <i class="fas fa-download text-5xl text-pink-500 mb-4"></i>
129
  </label>
130
  </div>
131
  </div>
132
- <div id="processStatus" class="hidden mt-4">
133
  <div class="flex items-center justify-end space-x-3 bg-indigo-100 rounded-xl p-4">
134
- <span class="text-lg text-indigo-700">جارٍ معالجة الملف...</span>
135
- <div class="animate-spin h-8 w-8 border-4 border-indigo-600 rounded-full border-t-transparent"></div>
136
  </div>
137
  </div>
138
  </div>
139
 
140
  <!-- قسم إدخال النصوص يدويًا -->
141
  <div class="card card-hover">
142
- <div class="space-y-6">
143
  <!-- النص المصدر -->
144
  <div class="group">
145
- <label class="block text-lg font-bold text-gray-700 mb-3">
146
  <i class="fas fa-language icon text-indigo-600"></i> النص المصدر
147
  </label>
148
- <textarea id="sourceText" dir="rtl" class="w-full px-6 py-4 border-2 border-gray-200 rounded-xl focus:ring-indigo-200 focus:border-indigo-400 transition-all resize-none text-lg" rows="6" placeholder="اكتب النص المصدر هنا..."></textarea>
149
  </div>
150
  <!-- النص الهدف -->
151
  <div class="group">
152
- <label class="block text-lg font-bold text-gray-700 mb-3">
153
  <i class="fas fa-language icon text-pink-600"></i> النص الهدف
154
  </label>
155
- <textarea id="targetText" dir="ltr" class="w-full px-6 py-4 border-2 border-gray-200 rounded-xl focus:ring-pink-200 focus:border-pink-400 transition-all resize-none text-lg" rows="6" placeholder="اكتب النص الهدف هنا..."></textarea>
156
  </div>
157
  </div>
158
  </div>
159
 
160
  <!-- قسم المصادر الإضافية -->
161
  <div class="card card-hover">
162
- <h2 class="text-2xl font-bold text-gray-800 border-b pb-3 mb-6">
163
  <i class="fas fa-book-open icon text-green-600"></i> مصادر إضافية
164
  </h2>
165
- <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
166
  <!-- رفع ملف المصادر الإضافية -->
167
- <div class="group border-2 border-dashed border-green-300 rounded-xl p-8 text-center bg-green-50 hover:bg-green-100 transition-colors duration-300">
168
  <label class="cursor-pointer block upload-label">
169
  <input type="file" id="sourceExtraFile" accept=".docx,.pdf" class="hidden">
170
- <span class="text-lg text-green-600 group-hover:text-green-700">تحميل ملف المصدر</span>
171
- <i class="fas fa-upload text-5xl text-green-500 mb-4"></i>
172
  </label>
173
  </div>
174
  <!-- إدخال المصادر يدويًا -->
175
  <div class="group">
176
- <label class="block text-lg font-bold text-gray-700 mb-3">
177
  <i class="fas fa-edit icon text-green-600"></i> إدخال المصادر يدويًا
178
  </label>
179
- <textarea id="sourceExtraText" dir="rtl" class="w-full px-6 py-4 border-2 border-green-200 rounded-xl focus:ring-green-200 focus:border-green-400 transition-all resize-none text-lg" rows="6" placeholder="اكتب المصادر هنا..."></textarea>
180
  </div>
181
  </div>
182
  </div>
183
 
184
  <!-- زر التحليل والمراجعة -->
185
- <button id="submitBtn" class="w-full bg-gradient-to-r from-indigo-600 to-pink-600 hover:from-indigo-700 hover:to-pink-700 text-white font-bold py-5 px-8 rounded-xl transition-all transform hover:scale-105 focus:ring-indigo-200 text-xl shadow-lg hover:shadow-xl pulse-animation">
186
  <div class="flex items-center justify-center">
187
  <span>تحليل ومراجعة النصوص</span>
188
- <i class="fas fa-sync-alt icon mr-2"></i>
189
  </div>
190
  </button>
191
 
192
  <!-- نتائج التحليل والمقارنة -->
193
  <div id="resultSection" class="card hidden">
194
- <h2 class="text-2xl font-bold text-gray-800 border-b pb-3 mb-6">
195
  <i class="fas fa-search icon text-green-600"></i> نتائج التحليل والمقارنة
196
  </h2>
197
- <div id="errorsList" class="space-y-3 mb-6"></div>
198
- <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
199
  <div>
200
- <h4 class="text-lg font-bold text-gray-700 mb-3">
201
  <i class="fas fa-file-alt icon text-indigo-600"></i> النص المصدر (مع التعليم)
202
  </h4>
203
- <div id="sourceTextReview" class="bg-indigo-50 rounded-xl p-6 min-h-[200px] border-2 border-indigo-100 text-comparison"></div>
204
  </div>
205
  <div>
206
- <h4 class="text-lg font-bold text-gray-700 mb-3">
207
  <i class="fas fa-file-alt icon text-pink-600"></i> النص الهدف (بدون تعليم)
208
  </h4>
209
- <div id="targetTextReview" class="bg-gray-50 rounded-xl p-6 min-h-[200px] border-2 border-gray-200 text-comparison"></div>
210
  </div>
211
  </div>
212
  </div>
213
 
214
  <!-- شرح تفصيلي للاختلافات -->
215
  <div id="explanationBox" class="card hidden">
216
- <h2 class="text-2xl font-bold text-gray-800 border-b pb-3 mb-6">
217
  <i class="fas fa-info-circle icon text-green-600"></i> شرح الاختلافات
218
  </h2>
219
- <div id="explanationText" class="text-lg text-gray-700"></div>
220
  </div>
221
  </main>
222
  </div>
@@ -229,29 +236,20 @@
229
  "use strict";
230
 
231
  /* تحسين البرومت:
232
- - مهمتك: مقارنة النص المصدر والنص الهدف واستخراج الاختلافات التالية:
233
- 1. **النصوص المفقودة:** الكلمات أو العبارات التي لم تُترجم من النص المصدر.
234
- 2. **الأرقام والتواريخ:** التي لا تتطابق بين النص المصدر والنص الهدف.
235
- - يُرجى تمييز:
236
- النصوص المفقودة بوضعها بين علامتي __ و __.
237
- الأرقام والتواريخ بوضعها بين علامتي < و >.
238
- - قم بالتحليل فقرة بفقرة، مع شرح مختصر لكل اختلاف وذكر رقم السطر إن أمكن.
239
- - إذا تم استخدام مصادر خارجية لشرح المصطلحات أو الاختصارات، ضع علامة [USED_SOURCE] في نهاية التحليل.
240
- - التزم بالتحليل الدقيق للإشارة فقط إلى الأخطاء دون تعليم عشوائي.
241
- */
242
- const API_URL = 'https://api.deepseek.com/chat/completions';
243
- const API_KEY = 'sk-15606736ed9e4aea8b7cc11a195d2b01';
244
- const ANALYSIS_PROMPT = `أنت خبير لغوي وتقني متخصص في مراجعة الترجمة التقنية وتحليل النصوص بدقة.
245
- مهمتك مقارنة النص المصدر والنص الهدف واستخراج الاختلافات التالية:
246
- 1. النصوص المفقودة: الكلمات أو العبارات التي لم تُترجم من النص المصدر.
247
- 2. الأرقام والتواريخ: التي لا تتطابق بين النص المصدر والنص الهدف.
248
- يُرجى تمييز:
249
- - النصوص المفقودة بوضعها بين علامتي __ و __.
250
- - الأرقام والتواريخ بوضعها بين علامتي < و >.
251
- قم بالتحليل فقرة بفقرة، مع شرح مختصر لكل اختلاف وذكر رقم السطر إن أمكن.
252
- إذا تم استخدام مصادر خارجية لشرح المصطلحات أو الاختصارات، ضع علامة [USED_SOURCE] في نهاية التحليل.
253
- التزم بالتحليل الدقيق للإشارة فقط إلى الأخطاء دون تعليم عشوائي.
254
-
255
  النص المصدر:
256
  {source}
257
 
@@ -283,7 +281,7 @@
283
  };
284
 
285
  /* -------------------------------
286
- دوال تظليل الاختلافات (التركيز على النصوص المفقودة والأرقام فقط)
287
  ------------------------------- */
288
  const applyHighlights = (originalText, analysisOutput) => {
289
  let highlightedText = originalText;
@@ -308,6 +306,16 @@
308
  highlightedText = highlightedText.replace(phraseRegex, replacement);
309
  }
310
  }
 
 
 
 
 
 
 
 
 
 
311
  return highlightedText;
312
  };
313
 
@@ -316,6 +324,9 @@
316
  let explanations = [];
317
  const iconMissing = `<i class="fas fa-exclamation-triangle mr-1"></i>`;
318
  const iconNumber = `<i class="fas fa-hashtag mr-1"></i>`;
 
 
 
319
  // تحليل النصوص المفقودة
320
  const missingRegex = /__(.*?)__/g;
321
  let match;
@@ -335,10 +346,30 @@
335
  explanations.push(`<p>${iconNumber} في السطر ${lineNum}: الرقم/التاريخ <span class="highlight-number">${phrase}</span></p>`);
336
  }
337
  }
338
- // التحقق من استخدام المصادر
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  const usedSource = analysisOutput.includes('[USED_SOURCE]');
340
- let sourceNote = usedSource ? `<p><i class="fas fa-book-reader mr-1"></i> تم استخدام مصادر خارجية لشرح المصطلحات.</p>`
341
  : `<p><i class="fas fa-book mr-1"></i> لم يتم استخدام مصادر خارجية.</p>`;
 
342
  if (explanations.length === 0) {
343
  return `<p><i class="fas fa-check-circle mr-2"></i> لا توجد اختلافات ملحوظة بين النصين.</p>` + sourceNote;
344
  }
@@ -397,7 +428,7 @@
397
  // رفع ملفات المصدر، الهدف والمصادر الإضافية
398
  processFileInput('sourceFile', 'sourceText', 'خطأ في معالجة ملف المصدر');
399
  processFileInput('targetFile', 'targetText', 'خطأ في معالجة ملف الهدف');
400
- processFileInput('sourceExtraFile', 'sourceExtraText', 'خطأ في معالجة ملف المصدر الإضافي');
401
 
402
  /* -------------------------------
403
  دالة عرض الأخطاء
@@ -439,8 +470,8 @@
439
  const progressDiv = document.createElement('div');
440
  progressDiv.className = "bg-indigo-100 p-4 rounded-xl mb-4";
441
  progressDiv.innerHTML = `<div class="flex items-center justify-end">
442
- <span>جارٍ التحليل...</span>
443
- <div class="animate-spin h-6 w-6 border-4 border-indigo-600 rounded-full border-t-transparent ml-3"></div>
444
  </div>`;
445
  document.getElementById('errorsList').appendChild(progressDiv);
446
 
@@ -451,7 +482,7 @@
451
  const payload = {
452
  model: "deepseek-chat",
453
  messages: [
454
- { role: "system", content: "أنت خبير في تحليل ومراجعة النصوص بدقة عالية." },
455
  { role: "user", content: prompt }
456
  ],
457
  temperature: 0.3,
@@ -483,7 +514,7 @@
483
  document.getElementById('errorsList').appendChild(checkDiv);
484
  document.getElementById('sourceTextReview').innerHTML = splitIntoLines(sourceText);
485
  document.getElementById('targetTextReview').innerHTML = splitIntoLines(targetText);
486
- document.getElementById('explanationText').innerHTML = `<p>النصوص متطابقة ولا يوجد اختلاف يجب الإشارة إليه.</p>`;
487
  } else {
488
  // تطبيق التعليم فقط على النص المصدر
489
  const sourceHighlighted = applyHighlights(sourceText, analysisOutput);
 
10
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
11
  <style>
12
  /* -------------------------------
13
+ الحركات والتأثيرات والتنسيقات المحسنة
14
  ------------------------------- */
15
  @keyframes gradient {
16
  0% { background-position: 0% 50%; }
 
32
  }
33
 
34
  /* -------------------------------
35
+ تنسيقات النص والتظليل
36
  ------------------------------- */
37
  .text-comparison { line-height: 1.8; white-space: pre-wrap; }
38
  .highlight-missing {
 
49
  border-radius: 3px;
50
  font-weight: bold;
51
  }
52
+ .highlight-abbreviation {
53
+ background-color: #34d399; /* أخضر */
54
+ color: #fff;
55
+ padding: 0 4px;
56
+ border-radius: 3px;
57
+ font-weight: bold;
58
+ }
59
 
60
  /* -------------------------------
61
  تنسيق الفقرات وترقيمها
 
99
  <body class="bg-gradient-to-br from-gray-100 via-blue-100 to-indigo-100 min-h-screen">
100
  <div class="min-h-screen pb-12">
101
  <!-- رأس الصفحة -->
102
+ <header class="bg-gradient-to-r from-indigo-800 via-purple-800 to-pink-800 animate-gradient text-white py-12 mb-12 shadow-2xl">
103
  <div class="max-w-6xl mx-auto px-4 text-center">
104
+ <h1 class="text-6xl font-extrabold mb-4 animate-scale">
105
  نظام المقارنة والتحليل المتقدم
106
  <i class="fas fa-chart-line icon"></i>
107
  </h1>
108
+ <p class="text-2xl opacity-90">
109
+ تحليل دقيق يشمل النصوص المفقودة، الأرقام/التواريخ، وفهم الاختصارات
110
  </p>
111
  </div>
112
  </header>
113
 
114
  <!-- المحتوى الرئيسي -->
115
+ <main class="max-w-7xl mx-auto px-4 space-y-10">
116
  <!-- قسم رفع الملفات -->
117
  <div class="card card-hover">
118
+ <h2 class="text-3xl font-bold text-gray-800 border-b pb-3 mb-6">
119
  <i class="fas fa-file-upload icon text-indigo-600"></i> تحميل الملفات
120
  </h2>
121
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
122
  <!-- ملف المصدر -->
123
+ <div class="group border-2 border-dashed border-indigo-300 rounded-xl p-10 text-center bg-indigo-50 hover:bg-indigo-100 transition-colors duration-300">
124
  <label class="cursor-pointer block upload-label">
125
  <input type="file" id="sourceFile" accept=".docx,.pdf" class="hidden">
126
+ <span class="text-xl text-indigo-600 group-hover:text-indigo-700">ملف المصدر</span>
127
+ <i class="fas fa-upload text-6xl text-indigo-500 mb-4"></i>
128
  </label>
129
  </div>
130
  <!-- ملف الهدف -->
131
+ <div class="group border-2 border-dashed border-pink-300 rounded-xl p-10 text-center bg-pink-50 hover:bg-pink-100 transition-colors duration-300">
132
  <label class="cursor-pointer block upload-label">
133
  <input type="file" id="targetFile" accept=".docx,.pdf" class="hidden">
134
+ <span class="text-xl text-pink-600 group-hover:text-pink-700">ملف الهدف</span>
135
+ <i class="fas fa-download text-6xl text-pink-500 mb-4"></i>
136
  </label>
137
  </div>
138
  </div>
139
+ <div id="processStatus" class="hidden mt-6">
140
  <div class="flex items-center justify-end space-x-3 bg-indigo-100 rounded-xl p-4">
141
+ <span class="text-xl text-indigo-700">جارٍ معالجة الملف...</span>
142
+ <div class="animate-spin h-10 w-10 border-4 border-indigo-600 rounded-full border-t-transparent"></div>
143
  </div>
144
  </div>
145
  </div>
146
 
147
  <!-- قسم إدخال النصوص يدويًا -->
148
  <div class="card card-hover">
149
+ <div class="space-y-8">
150
  <!-- النص المصدر -->
151
  <div class="group">
152
+ <label class="block text-2xl font-bold text-gray-700 mb-4">
153
  <i class="fas fa-language icon text-indigo-600"></i> النص المصدر
154
  </label>
155
+ <textarea id="sourceText" dir="rtl" class="w-full px-8 py-6 border-2 border-gray-200 rounded-xl focus:ring-indigo-200 focus:border-indigo-400 transition-all resize-none text-xl" rows="8" placeholder="اكتب النص المصدر هنا..."></textarea>
156
  </div>
157
  <!-- النص الهدف -->
158
  <div class="group">
159
+ <label class="block text-2xl font-bold text-gray-700 mb-4">
160
  <i class="fas fa-language icon text-pink-600"></i> النص الهدف
161
  </label>
162
+ <textarea id="targetText" dir="ltr" class="w-full px-8 py-6 border-2 border-gray-200 rounded-xl focus:ring-pink-200 focus:border-pink-400 transition-all resize-none text-xl" rows="8" placeholder="اكتب النص الهدف هنا..."></textarea>
163
  </div>
164
  </div>
165
  </div>
166
 
167
  <!-- قسم المصادر الإضافية -->
168
  <div class="card card-hover">
169
+ <h2 class="text-3xl font-bold text-gray-800 border-b pb-3 mb-6">
170
  <i class="fas fa-book-open icon text-green-600"></i> مصادر إضافية
171
  </h2>
172
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
173
  <!-- رفع ملف المصادر الإضافية -->
174
+ <div class="group border-2 border-dashed border-green-300 rounded-xl p-10 text-center bg-green-50 hover:bg-green-100 transition-colors duration-300">
175
  <label class="cursor-pointer block upload-label">
176
  <input type="file" id="sourceExtraFile" accept=".docx,.pdf" class="hidden">
177
+ <span class="text-xl text-green-600 group-hover:text-green-700">تحميل ملف المصادر</span>
178
+ <i class="fas fa-upload text-6xl text-green-500 mb-4"></i>
179
  </label>
180
  </div>
181
  <!-- إدخال المصادر يدويًا -->
182
  <div class="group">
183
+ <label class="block text-2xl font-bold text-gray-700 mb-4">
184
  <i class="fas fa-edit icon text-green-600"></i> إدخال المصادر يدويًا
185
  </label>
186
+ <textarea id="sourceExtraText" dir="rtl" class="w-full px-8 py-6 border-2 border-green-200 rounded-xl focus:ring-green-200 focus:border-green-400 transition-all resize-none text-xl" rows="8" placeholder="اكتب المصادر هنا..."></textarea>
187
  </div>
188
  </div>
189
  </div>
190
 
191
  <!-- زر التحليل والمراجعة -->
192
+ <button id="submitBtn" class="w-full bg-gradient-to-r from-indigo-700 to-pink-700 hover:from-indigo-800 hover:to-pink-800 text-white font-bold py-6 px-10 rounded-xl transition-all transform hover:scale-105 focus:ring-indigo-200 text-2xl shadow-2xl hover:shadow-2xl pulse-animation">
193
  <div class="flex items-center justify-center">
194
  <span>تحليل ومراجعة النصوص</span>
195
+ <i class="fas fa-sync-alt icon mr-4"></i>
196
  </div>
197
  </button>
198
 
199
  <!-- نتائج التحليل والمقارنة -->
200
  <div id="resultSection" class="card hidden">
201
+ <h2 class="text-3xl font-bold text-gray-800 border-b pb-4 mb-6">
202
  <i class="fas fa-search icon text-green-600"></i> نتائج التحليل والمقارنة
203
  </h2>
204
+ <div id="errorsList" class="space-y-4 mb-6"></div>
205
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
206
  <div>
207
+ <h4 class="text-2xl font-bold text-gray-700 mb-4">
208
  <i class="fas fa-file-alt icon text-indigo-600"></i> النص المصدر (مع التعليم)
209
  </h4>
210
+ <div id="sourceTextReview" class="bg-indigo-50 rounded-xl p-8 min-h-[250px] border-2 border-indigo-200 text-comparison"></div>
211
  </div>
212
  <div>
213
+ <h4 class="text-2xl font-bold text-gray-700 mb-4">
214
  <i class="fas fa-file-alt icon text-pink-600"></i> النص الهدف (بدون تعليم)
215
  </h4>
216
+ <div id="targetTextReview" class="bg-gray-50 rounded-xl p-8 min-h-[250px] border-2 border-gray-300 text-comparison"></div>
217
  </div>
218
  </div>
219
  </div>
220
 
221
  <!-- شرح تفصيلي للاختلافات -->
222
  <div id="explanationBox" class="card hidden">
223
+ <h2 class="text-3xl font-bold text-gray-800 border-b pb-4 mb-6">
224
  <i class="fas fa-info-circle icon text-green-600"></i> شرح الاختلافات
225
  </h2>
226
+ <div id="explanationText" class="text-2xl text-gray-700"></div>
227
  </div>
228
  </main>
229
  </div>
 
236
  "use strict";
237
 
238
  /* تحسين البرومت:
239
+ - مهمتك: مقارنة النص المصدر والنص الهدف بدقة عالية مع مراعاة فهم الاختصارات.
240
+ - إذا كانت النصوص متطابقة تماماً، أرجع [MATCH] فقط.
241
+ - إذا كان هناك اختلافات، قم بتحديد الأنواع التالية:
242
+ 1. النصوص المفقودة: الكلمات أو العبارات الموجودة في النص المصدر وغير موجودة في النص الهدف.
243
+ 2. الأرقام والتواريخ: التي يجب أن تكون مطابقة بين النصين؛ وفي حال وجود اختلاف، قم بالإشارة إليه.
244
+ 3. اختلاف المعنى: إذا كانت الترجمة تحمل معنى مختلفاً عن النص المصدر.
245
+ 4. الاختصارات: يجب على النموذج فهم الاختصارات وتحليلها بدقة (مع مراعاة معانيها الكاملة) وعدم اعتبارها خطأ إذا كانت مستخدمة بشكل سليم.
246
+ - استخدم العلامات التالية لتعليم النص المصدر فقط:
247
+ النصوص المفقودة بين علامتي __ و __.
248
+ • الأرقام والتواريخ بين علامتي < و >.
249
+ اختلاف المعنى بين علامتي [MEANING] و [/MEANING].
250
+ الاختصارات بين علامتي {ABBR} و {/ABBR}.
251
+ - قدم الناتج في شكل قائمة مفصلة مع شرح مختصر لكل اختلاف وذكر رقم السطر إن أمكن.
252
+
 
 
 
 
 
 
 
 
 
253
  النص المصدر:
254
  {source}
255
 
 
281
  };
282
 
283
  /* -------------------------------
284
+ دوال تظليل الاختلافات (التركيز على النصوص المفقودة، الأرقام والاختصارات)
285
  ------------------------------- */
286
  const applyHighlights = (originalText, analysisOutput) => {
287
  let highlightedText = originalText;
 
306
  highlightedText = highlightedText.replace(phraseRegex, replacement);
307
  }
308
  }
309
+ // تظليل الاختصارات
310
+ const abbrRegex = /{ABBR}(.*?){\/ABBR}/g;
311
+ while ((match = abbrRegex.exec(analysisOutput)) !== null) {
312
+ const phrase = match[1].trim();
313
+ if (phrase) {
314
+ const replacement = `<span class="highlight-abbreviation">${phrase}</span>`;
315
+ const phraseRegex = new RegExp(escapeRegExp(phrase), 'g');
316
+ highlightedText = highlightedText.replace(phraseRegex, replacement);
317
+ }
318
+ }
319
  return highlightedText;
320
  };
321
 
 
324
  let explanations = [];
325
  const iconMissing = `<i class="fas fa-exclamation-triangle mr-1"></i>`;
326
  const iconNumber = `<i class="fas fa-hashtag mr-1"></i>`;
327
+ const iconMeaning = `<i class="fas fa-info-circle mr-1"></i>`;
328
+ const iconAbbr = `<i class="fas fa-font mr-1"></i>`;
329
+
330
  // تحليل النصوص المفقودة
331
  const missingRegex = /__(.*?)__/g;
332
  let match;
 
346
  explanations.push(`<p>${iconNumber} في السطر ${lineNum}: الرقم/التاريخ <span class="highlight-number">${phrase}</span></p>`);
347
  }
348
  }
349
+ // تحليل اختلاف المعنى
350
+ const meaningRegex = /\[MEANING\](.*?)\[\/MEANING\]/g;
351
+ while ((match = meaningRegex.exec(analysisOutput)) !== null) {
352
+ const phrase = match[1].trim();
353
+ if (phrase) {
354
+ const lineNum = getLineNumber(sourceText, phrase);
355
+ explanations.push(`<p>${iconMeaning} في السطر ${lineNum}: اختلاف المعنى <span class="highlight-missing">${phrase}</span></p>`);
356
+ }
357
+ }
358
+ // تحليل الاختصارات
359
+ const abbrRegex = /{ABBR}(.*?){\/ABBR}/g;
360
+ while ((match = abbrRegex.exec(analysisOutput)) !== null) {
361
+ const phrase = match[1].trim();
362
+ if (phrase) {
363
+ const lineNum = getLineNumber(sourceText, phrase);
364
+ explanations.push(`<p>${iconAbbr} في السطر ${lineNum}: الاختصار <span class="highlight-abbreviation">${phrase}</span></p>`);
365
+ }
366
+ }
367
+
368
+ // التحقق من استخدام المصادر الخارجية
369
  const usedSource = analysisOutput.includes('[USED_SOURCE]');
370
+ let sourceNote = usedSource ? `<p><i class="fas fa-book-reader mr-1"></i> تم استخدام مصادر خارجية لشرح الاختصارات والمصطلحات.</p>`
371
  : `<p><i class="fas fa-book mr-1"></i> لم يتم استخدام مصادر خارجية.</p>`;
372
+
373
  if (explanations.length === 0) {
374
  return `<p><i class="fas fa-check-circle mr-2"></i> لا توجد اختلافات ملحوظة بين النصين.</p>` + sourceNote;
375
  }
 
428
  // رفع ملفات المصدر، الهدف والمصادر الإضافية
429
  processFileInput('sourceFile', 'sourceText', 'خطأ في معالجة ملف المصدر');
430
  processFileInput('targetFile', 'targetText', 'خطأ في معالجة ملف الهدف');
431
+ processFileInput('sourceExtraFile', 'sourceExtraText', 'خطأ في معالجة ملف المصادر الإضافية');
432
 
433
  /* -------------------------------
434
  دالة عرض الأخطاء
 
470
  const progressDiv = document.createElement('div');
471
  progressDiv.className = "bg-indigo-100 p-4 rounded-xl mb-4";
472
  progressDiv.innerHTML = `<div class="flex items-center justify-end">
473
+ <span class="text-xl">جارٍ التحليل...</span>
474
+ <div class="animate-spin h-10 w-10 border-4 border-indigo-600 rounded-full border-t-transparent ml-4"></div>
475
  </div>`;
476
  document.getElementById('errorsList').appendChild(progressDiv);
477
 
 
482
  const payload = {
483
  model: "deepseek-chat",
484
  messages: [
485
+ { role: "system", content: "أنت خبير في تحليل ومراجعة النصوص بدقة عالية، وتفهم الاختصارات ومعانيها الكاملة." },
486
  { role: "user", content: prompt }
487
  ],
488
  temperature: 0.3,
 
514
  document.getElementById('errorsList').appendChild(checkDiv);
515
  document.getElementById('sourceTextReview').innerHTML = splitIntoLines(sourceText);
516
  document.getElementById('targetTextReview').innerHTML = splitIntoLines(targetText);
517
+ document.getElementById('explanationText').innerHTML = `<p class="text-xl">النصوص متطابقة ولا يوجد اختلاف يجب الإشارة إليه.</p>`;
518
  } else {
519
  // تطبيق التعليم فقط على النص المصدر
520
  const sourceHighlighted = applyHighlights(sourceText, analysisOutput);