helloboyn commited on
Commit
ba5e443
·
verified ·
1 Parent(s): a0c6f6a
Files changed (3) hide show
  1. eng-hin-test.eng.txt +0 -0
  2. eng-hin-test.hin.txt +0 -0
  3. index.html +439 -0
eng-hin-test.eng.txt ADDED
The diff for this file is too large to render. See raw diff
 
eng-hin-test.hin.txt ADDED
The diff for this file is too large to render. See raw diff
 
index.html ADDED
@@ -0,0 +1,439 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>The State of Legal Machine Translation: An Infographic</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
9
+ <link rel="preconnect" href="https://fonts.googleapis.com">
10
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
12
+ <style>
13
+ body {
14
+ font-family: 'Inter', sans-serif;
15
+ background-color: #F0F4F8;
16
+ }
17
+ .chart-container {
18
+ position: relative;
19
+ width: 100%;
20
+ max-width: 600px;
21
+ margin-left: auto;
22
+ margin-right: auto;
23
+ height: 350px;
24
+ max-height: 400px;
25
+ }
26
+ @media (min-width: 768px) {
27
+ .chart-container {
28
+ height: 400px;
29
+ }
30
+ }
31
+ .kpi-card {
32
+ background-color: white;
33
+ border-radius: 0.5rem;
34
+ box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
35
+ padding: 1.5rem;
36
+ text-align: center;
37
+ transition: transform 0.3s ease;
38
+ }
39
+ .kpi-card:hover {
40
+ transform: translateY(-5px);
41
+ }
42
+ .flowchart-step {
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ text-align: center;
47
+ padding: 1rem;
48
+ border-radius: 0.5rem;
49
+ color: #ffffff;
50
+ font-weight: 600;
51
+ min-height: 80px;
52
+ }
53
+ .flowchart-arrow {
54
+ font-size: 2rem;
55
+ color: #1E3A8A;
56
+ margin: 0 1rem;
57
+ transform: rotate(90deg);
58
+ }
59
+ @media (min-width: 768px) {
60
+ .flowchart-arrow {
61
+ transform: rotate(0deg);
62
+ }
63
+ }
64
+ </style>
65
+ </head>
66
+ <body class="bg-gray-50 text-gray-800">
67
+
68
+ <div class="container mx-auto p-4 md:p-8">
69
+
70
+ <header class="text-center mb-12">
71
+ <h1 class="text-4xl md:text-5xl font-bold text-blue-900 mb-2">Advancing Legal Machine Translation</h1>
72
+ <p class="text-lg text-gray-600 max-w-3xl mx-auto">An infographic visualizing the key findings from the WMT25 Legal Domain Test Suite, highlighting the performance of Large Language Models (LLMs) and the future of automated legal text translation.</p>
73
+ </header>
74
+
75
+ <section id="overview" class="mb-16">
76
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
77
+ <div class="kpi-card bg-blue-100 border-l-4 border-blue-500">
78
+ <h3 class="text-5xl font-bold text-blue-900">5,000</h3>
79
+ <p class="text-gray-700 mt-2">Sentences Analyzed</p>
80
+ <p class="text-sm text-gray-500 mt-1">From the WMT25 English-Hindi legal dataset, ranging from 5 to 55 words in length.</p>
81
+ </div>
82
+ <div class="kpi-card bg-green-100 border-l-4 border-green-500">
83
+ <h3 class="text-5xl font-bold text-green-900">33.35</h3>
84
+ <p class="text-gray-700 mt-2">Top BLEU Score</p>
85
+ <p class="text-sm text-gray-500 mt-1">Achieved by Gemini-2.5-Pro, demonstrating superior lexical accuracy.</p>
86
+ </div>
87
+ <div class="kpi-card bg-purple-100 border-l-4 border-purple-500">
88
+ <h3 class="text-5xl font-bold text-purple-900">60.95</h3>
89
+ <p class="text-gray-700 mt-2">Top CHRF++ Score</p>
90
+ <p class="text-sm text-gray-500 mt-1">Also by Gemini-2.5-Pro, indicating high character-level fidelity, crucial for legal texts.</p>
91
+ </div>
92
+ </div>
93
+ </section>
94
+
95
+ <section id="performance-comparison" class="mb-16">
96
+ <div class="bg-white rounded-lg shadow-md p-6">
97
+ <h2 class="text-3xl font-bold text-center text-blue-900 mb-2">Model Performance Leaderboard</h2>
98
+ <p class="text-center text-gray-600 mb-8 max-w-2xl mx-auto">This chart compares the top 10 Machine Translation systems based on the COMET score, a metric highly correlated with human judgment. LLM-based systems clearly dominate the top ranks.</p>
99
+ <div class="chart-container h-[500px] max-h-[500px]">
100
+ <canvas id="leaderboardChart"></canvas>
101
+ </div>
102
+ <p class="text-sm text-gray-500 mt-4 text-center">The chart visualizes the COMET scores, which predict human judgments of translation quality. Higher scores indicate better performance. Gemini-2.5-Pro leads, followed closely by a mix of specialized NMT and other large language models, showcasing the competitive landscape.</p>
103
+ </div>
104
+ </section>
105
+
106
+ <section id="metric-deep-dive" class="mb-16">
107
+ <div class="bg-white rounded-lg shadow-md p-6">
108
+ <h2 class="text-3xl font-bold text-center text-blue-900 mb-2">Performance Across Key Metrics</h2>
109
+ <p class="text-center text-gray-600 mb-8 max-w-2xl mx-auto">This radar chart provides a multi-faceted view of the top 5 systems, comparing their performance across three critical and complementary evaluation metrics: BLEU, METEOR, and CHRF++.</p>
110
+ <div class="chart-container">
111
+ <canvas id="radarChart"></canvas>
112
+ </div>
113
+ <p class="text-sm text-gray-500 mt-4 text-center">Each axis represents a different quality metric. A larger area indicates a more balanced and robust performance. Gemini-2.5-Pro shows strong, well-rounded capabilities, while other systems exhibit varying strengths. For instance, some systems excel in lexical overlap (BLEU) but are weaker in character-level accuracy (CHRF++).</p>
114
+ </div>
115
+ </section>
116
+
117
+ <section id="gemini-tool" class="mb-16">
118
+ <div class="bg-white rounded-lg shadow-md p-6">
119
+ <h2 class="text-3xl font-bold text-center text-blue-900 mb-2">✨ Legal Translation & Analysis Tool ✨</h2>
120
+ <p class="text-center text-gray-600 mb-6 max-w-2xl mx-auto">Input a legal phrase or sentence in English and let the Gemini API provide a translation and a brief quality analysis.</p>
121
+ <div class="max-w-2xl mx-auto">
122
+ <div class="mb-4">
123
+ <label for="inputText" class="block text-gray-700 font-bold mb-2">Enter English Legal Text:</label>
124
+ <textarea id="inputText" class="w-full p-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" rows="4" placeholder="e.g., The defendant is presumed innocent until proven guilty beyond a reasonable doubt."></textarea>
125
+ </div>
126
+ <div class="mb-6">
127
+ <label for="languageSelect" class="block text-gray-700 font-bold mb-2">Translate to:</label>
128
+ <select id="languageSelect" class="w-full p-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
129
+ <option value="Hindi">Hindi</option>
130
+ <option value="English">English</option>
131
+ </select>
132
+ </div>
133
+ <button id="translateButton" class="w-full bg-blue-600 text-white font-bold py-3 px-4 rounded-md shadow-lg hover:bg-blue-700 transition duration-300 ease-in-out transform hover:scale-105">
134
+ ✨ Translate & Analyze ✨
135
+ </button>
136
+ <div id="output" class="mt-8 p-6 bg-gray-50 rounded-lg border border-gray-200">
137
+ <span id="loading" class="hidden text-gray-500">Translating and analyzing...</span>
138
+ <div id="translationResult" class="hidden">
139
+ <h4 class="font-bold text-xl text-blue-900 mb-2">Translation:</h4>
140
+ <p id="translatedText" class="text-gray-700 text-lg mb-4"></p>
141
+ <h4 class="font-bold text-xl text-blue-900 mb-2">Analysis:</h4>
142
+ <p id="analysisText" class="text-gray-700"></p>
143
+ </div>
144
+ </div>
145
+ </div>
146
+ </div>
147
+ </section>
148
+
149
+ <section id="evaluation-evolution" class="mb-16">
150
+ <h2 class="text-3xl font-bold text-center text-blue-900 mb-2">The Evolution of Translation Evaluation</h2>
151
+ <p class="text-center text-gray-600 mb-8 max-w-2xl mx-auto">The methodology for assessing translation quality is shifting from simple word-matching to more nuanced, human-aligned frameworks. This is crucial in the legal field where meaning and precision are paramount.</p>
152
+ <div class="flex flex-col md:flex-row items-center justify-center space-y-4 md:space-y-0 md:space-x-4">
153
+ <div class="flowchart-step bg-blue-800 w-full md:w-1/4">
154
+ <p><strong>Traditional Metrics</strong><br><span class="font-normal text-sm">(e.g., BLEU)</span></p>
155
+ </div>
156
+ <div class="flowchart-arrow">➔</div>
157
+ <div class="flowchart-step bg-blue-700 w-full md:w-1/4">
158
+ <p><strong>Advanced Metrics</strong><br><span class="font-normal text-sm">(e.g., METEOR, CHRF++)</span></p>
159
+ </div>
160
+ <div class="flowchart-arrow">➔</div>
161
+ <div class="flowchart-step bg-blue-600 w-full md:w-1/4">
162
+ <p><strong>Neural & Human-Aligned</strong><br><span class="font-normal text-sm">(e.g., COMET, MQM)</span></p>
163
+ </div>
164
+ </div>
165
+ <div class="mt-8 grid grid-cols-1 md:grid-cols-3 gap-6 text-center">
166
+ <div class="p-4">
167
+ <h4 class="font-bold text-lg text-blue-900">Lexical Overlap</h4>
168
+ <p class="text-gray-600">Early metrics focused on matching words and phrases, which is useful for terminology but misses overall fluency and meaning.</p>
169
+ </div>
170
+ <div class="p-4">
171
+ <h4 class="font-bold text-lg text-blue-900">Semantic & Structural Similarity</h4>
172
+ <p class="text-gray-600">Metrics like METEOR and CHRF++ improved evaluation by considering synonyms, word stems, and character sequences, offering a more accurate quality signal.</p>
173
+ </div>
174
+ <div class="p-4">
175
+ <h4 class="font-bold text-lg text-blue-900">Explainable & Human-Aligned</h4>
176
+ <p class="text-gray-600">Modern frameworks like COMET and MQM aim to replicate human judgment, identifying specific error types and providing actionable feedback for improvement.</p>
177
+ </div>
178
+ </div>
179
+ </section>
180
+
181
+ <section id="challenges" class="mb-16">
182
+ <div class="bg-white rounded-lg shadow-md p-6">
183
+ <h2 class="text-3xl font-bold text-center text-blue-900 mb-2">Critical Challenges & The Path Forward</h2>
184
+ <p class="text-center text-gray-600 mb-8 max-w-2xl mx-auto">While LLMs show immense promise, their deployment in high-stakes legal environments requires addressing key challenges related to reliability and trustworthiness.</p>
185
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
186
+ <div class="bg-red-50 p-6 rounded-lg border-l-4 border-red-500">
187
+ <h4 class="font-bold text-xl text-red-900 mb-2">🚨 The Hallucination Problem</h4>
188
+ <p class="text-gray-700">LLMs can generate plausible but factually incorrect or legally unsound content. In a legal context, this poses a significant risk, potentially leading to contractual disputes or miscarriages of justice.</p>
189
+ </div>
190
+ <div class="bg-green-50 p-6 rounded-lg border-l-4 border-green-500">
191
+ <h4 class="font-bold text-xl text-green-900 mb-2">💡 The Need for Explainability</h4>
192
+ <p class="text-gray-700">Legal reasoning must be transparent and auditable. "Black-box" AI is insufficient. The future lies in Neuro-Symbolic AI, which combines LLM fluency with logic-based systems to provide clear, traceable, and justifiable outputs that align with legal standards.</p>
193
+ </div>
194
+ </div>
195
+ </div>
196
+ </section>
197
+
198
+ <footer class="text-center mt-12 py-6 border-t border-gray-300">
199
+ <p class="text-gray-600">Infographic based on the WMT25 Legal Domain Test Suite System Paper and accompanying dataset.</p>
200
+ <p class="text-sm text-gray-500 mt-1">Create with love by helloboyn.</p>
201
+ </footer>
202
+ </div>
203
+
204
+ <script>
205
+ const vibrantPalette = {
206
+ blue900: '#1E3A8A',
207
+ blue800: '#1E40AF',
208
+ blue700: '#1D4ED8',
209
+ blue600: '#2563EB',
210
+ green500: '#22C55E',
211
+ purple500: '#8B5CF6',
212
+ red500: '#EF4444',
213
+ gray600: '#4B5563',
214
+ white: '#FFFFFF'
215
+ };
216
+
217
+ function wrapLabel(label, maxLength = 16) {
218
+ if (label.length <= maxLength) {
219
+ return label;
220
+ }
221
+ const words = label.split(' ');
222
+ const lines = [];
223
+ let currentLine = '';
224
+ for (const word of words) {
225
+ if ((currentLine + ' ' + word).trim().length > maxLength) {
226
+ lines.push(currentLine.trim());
227
+ currentLine = word;
228
+ } else {
229
+ currentLine = (currentLine + ' ' + word).trim();
230
+ }
231
+ }
232
+ if (currentLine) {
233
+ lines.push(currentLine.trim());
234
+ }
235
+ return lines;
236
+ }
237
+
238
+ const tooltipTitleCallback = function(tooltipItems) {
239
+ const item = tooltipItems[0];
240
+ let label = item.chart.data.labels[item.dataIndex];
241
+ if (Array.isArray(label)) {
242
+ return label.join(' ');
243
+ } else {
244
+ return label;
245
+ }
246
+ };
247
+
248
+ const leaderboardData = {
249
+ systems: ['Gemini-2.5-Pro', 'hybrid', 'TranssionTranslate', 'Claude-4', 'ONLINE-B', 'Llama-4-Maverick', 'NLLB', 'DeepSeek-V3', 'GPT-4.1', 'TowerPlus-9B'],
250
+ cometScores: [72.27, 71.20, 71.01, 70.99, 70.96, 69.86, 68.16, 71.20, 68.16, 68.85]
251
+ };
252
+
253
+ new Chart(document.getElementById('leaderboardChart'), {
254
+ type: 'bar',
255
+ data: {
256
+ labels: leaderboardData.systems.map(label => wrapLabel(label)),
257
+ datasets: [{
258
+ label: 'COMET Score',
259
+ data: leaderboardData.cometScores,
260
+ backgroundColor: [vibrantPalette.blue800, vibrantPalette.blue700, vibrantPalette.blue600, '#3B82F6', '#60A5FA', '#93C5FD', '#BFDBFE', '#DBEAFE', '#EBF5FF', '#F0F9FF'],
261
+ borderColor: vibrantPalette.blue900,
262
+ borderWidth: 1
263
+ }]
264
+ },
265
+ options: {
266
+ indexAxis: 'y',
267
+ responsive: true,
268
+ maintainAspectRatio: false,
269
+ scales: {
270
+ x: {
271
+ beginAtZero: false,
272
+ min: 65,
273
+ title: {
274
+ display: true,
275
+ text: 'COMET Score (Higher is Better)',
276
+ color: vibrantPalette.gray600,
277
+ font: { size: 14 }
278
+ }
279
+ },
280
+ y: {
281
+ ticks: {
282
+ font: { size: 10 }
283
+ }
284
+ }
285
+ },
286
+ plugins: {
287
+ legend: {
288
+ display: false
289
+ },
290
+ tooltip: {
291
+ callbacks: {
292
+ title: tooltipTitleCallback
293
+ }
294
+ }
295
+ }
296
+ }
297
+ });
298
+
299
+ const radarData = {
300
+ labels: ['BLEU', 'METEOR', 'CHRF++'],
301
+ datasets: [
302
+ {
303
+ label: 'Gemini-2.5-Pro',
304
+ data: [33.35, 53.91, 60.95],
305
+ borderColor: vibrantPalette.blue800,
306
+ backgroundColor: 'rgba(30, 64, 175, 0.2)',
307
+ pointBackgroundColor: vibrantPalette.blue800,
308
+ },
309
+ {
310
+ label: 'ONLINE-B',
311
+ data: [31.77, 52.37, 57.81],
312
+ borderColor: vibrantPalette.green500,
313
+ backgroundColor: 'rgba(34, 197, 94, 0.2)',
314
+ pointBackgroundColor: vibrantPalette.green500,
315
+ },
316
+ {
317
+ label: 'TranssionTranslate',
318
+ data: [31.65, 52.42, 57.83],
319
+ borderColor: vibrantPalette.purple500,
320
+ backgroundColor: 'rgba(139, 92, 246, 0.2)',
321
+ pointBackgroundColor: vibrantPalette.purple500,
322
+ },
323
+ {
324
+ label: 'ONLINE-G',
325
+ data: [31.22, 57.30, 52.06],
326
+ borderColor: vibrantPalette.red500,
327
+ backgroundColor: 'rgba(239, 68, 68, 0.2)',
328
+ pointBackgroundColor: vibrantPalette.red500,
329
+ },
330
+ {
331
+ label: 'Claude-4',
332
+ data: [31.09, 52.75, 57.87],
333
+ borderColor: '#F97316',
334
+ backgroundColor: 'rgba(249, 115, 22, 0.2)',
335
+ pointBackgroundColor: '#F97316',
336
+ }
337
+ ]
338
+ };
339
+
340
+ new Chart(document.getElementById('radarChart'), {
341
+ type: 'radar',
342
+ data: radarData,
343
+ options: {
344
+ responsive: true,
345
+ maintainAspectRatio: false,
346
+ elements: {
347
+ line: {
348
+ borderWidth: 3
349
+ }
350
+ },
351
+ scales: {
352
+ r: {
353
+ angleLines: {
354
+ display: true
355
+ },
356
+ suggestedMin: 20,
357
+ suggestedMax: 65,
358
+ pointLabels: {
359
+ font: {
360
+ size: 14,
361
+ weight: 'bold'
362
+ }
363
+ }
364
+ }
365
+ },
366
+ plugins: {
367
+ tooltip: {
368
+ callbacks: {
369
+ title: tooltipTitleCallback
370
+ }
371
+ },
372
+ legend: {
373
+ position: 'top',
374
+ }
375
+ }
376
+ }
377
+ });
378
+
379
+ document.getElementById('translateButton').addEventListener('click', translateText);
380
+
381
+ async function translateText() {
382
+ const inputText = document.getElementById('inputText').value;
383
+ const language = document.getElementById('languageSelect').value;
384
+ const outputDiv = document.getElementById('output');
385
+ const loadingSpan = document.getElementById('loading');
386
+ const resultDiv = document.getElementById('translationResult');
387
+ const translatedTextElem = document.getElementById('translatedText');
388
+ const analysisTextElem = document.getElementById('analysisText');
389
+
390
+ if (!inputText) {
391
+ alert('Please enter some text to translate.');
392
+ return;
393
+ }
394
+
395
+ loadingSpan.classList.remove('hidden');
396
+ resultDiv.classList.add('hidden');
397
+ translatedTextElem.textContent = '';
398
+ analysisTextElem.textContent = '';
399
+
400
+ const prompt = `Translate the following legal text from English to ${language}. After the translation, provide a brief analysis (in English) of the translation's quality, noting any potential ambiguities, cultural nuances, or legal-specific terms that are difficult to capture perfectly. Format the response as "Translation: [translated text] Analysis: [analysis text]".
401
+ Text to translate: ${inputText}`;
402
+
403
+ try {
404
+ let chatHistory = [];
405
+ chatHistory.push({ role: "user", parts: [{ text: prompt }] });
406
+ const payload = { contents: chatHistory };
407
+ const apiKey = ""
408
+ const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-05-20:generateContent?key=${apiKey}`;
409
+ const response = await fetch(apiUrl, {
410
+ method: 'POST',
411
+ headers: { 'Content-Type': 'application/json' },
412
+ body: JSON.stringify(payload)
413
+ });
414
+ const result = await response.json();
415
+
416
+ if (result.candidates && result.candidates.length > 0 &&
417
+ result.candidates[0].content && result.candidates[0].content.parts &&
418
+ result.candidates[0].content.parts.length > 0) {
419
+ const text = result.candidates[0].content.parts[0].text;
420
+ const [translationPart, analysisPart] = text.split('Analysis:');
421
+ translatedTextElem.textContent = translationPart.replace('Translation:', '').trim();
422
+ analysisTextElem.textContent = analysisPart.trim();
423
+ resultDiv.classList.remove('hidden');
424
+ } else {
425
+ analysisTextElem.textContent = 'Could not get a valid response from the API.';
426
+ resultDiv.classList.remove('hidden');
427
+ }
428
+ } catch (error) {
429
+ console.error('Error fetching data:', error);
430
+ analysisTextElem.textContent = `An error occurred: ${error.message}`;
431
+ resultDiv.classList.remove('hidden');
432
+ } finally {
433
+ loadingSpan.classList.add('hidden');
434
+ }
435
+ }
436
+
437
+ </script>
438
+ </body>
439
+ </html>