sentimentanalyzer01 commited on
Commit
84c505b
·
verified ·
1 Parent(s): d6426c5

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +22 -5
templates/index.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Анализ эмоций текстов отзывов на русском языке</title>
7
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
8
  <style>
9
  * {
@@ -245,7 +245,7 @@
245
  <body>
246
  <div class="container">
247
  <div class="header">
248
- <h1>💬 Анализатор эмоций текстов отзывов</h1>
249
  <p>Гибридная каскадная модель LSTM + BERT с онтологической верификацией</p>
250
  </div>
251
 
@@ -476,7 +476,19 @@
476
  responsive: true,
477
  plugins: {
478
  legend: { position: 'bottom' },
479
- tooltip: { callbacks: { label: (ctx) => `${ctx.label}: ${ctx.raw} отзывов` } }
 
 
 
 
 
 
 
 
 
 
 
 
480
  }
481
  }
482
  });
@@ -484,9 +496,14 @@
484
  let html = '';
485
  const emotionsOrder = ['радость', 'грусть', 'злость', 'страх', 'сарказм'];
486
  for (const emotion of emotionsOrder) {
 
487
  const examples = data.examples[emotion] || [];
488
- if (examples.length > 0) {
489
- html += `<div class="examples-category"><h4>😊 ${emotion} (${examples.length})</h4>`;
 
 
 
 
490
  for (const ex of examples) {
491
  html += `
492
  <div class="example-item">
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Анализ эмоциональной окраски текстов отзывов на русском языке</title>
7
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
8
  <style>
9
  * {
 
245
  <body>
246
  <div class="container">
247
  <div class="header">
248
+ <h1>💬 Анализ эмоциональной окраски текстов отзывов на русском языке</h1>
249
  <p>Гибридная каскадная модель LSTM + BERT с онтологической верификацией</p>
250
  </div>
251
 
 
476
  responsive: true,
477
  plugins: {
478
  legend: { position: 'bottom' },
479
+ tooltip: {
480
+ callbacks: {
481
+ label: function(context) {
482
+ let label = context.label || '';
483
+ let value = context.raw;
484
+ let suffix = '';
485
+ if (value % 10 === 1 && value % 100 !== 11) suffix = 'отзыв';
486
+ else if (value % 10 >= 2 && value % 10 <= 4 && (value % 100 < 10 || value % 100 >= 20)) suffix = 'отзыва';
487
+ else suffix = 'отзывов';
488
+ return `${label}: ${value} ${suffix}`;
489
+ }
490
+ }
491
+ }
492
  }
493
  }
494
  });
 
496
  let html = '';
497
  const emotionsOrder = ['радость', 'грусть', 'злость', 'страх', 'сарказм'];
498
  for (const emotion of emotionsOrder) {
499
+ const count = data.emotion_counts[emotion] || 0;
500
  const examples = data.examples[emotion] || [];
501
+ if (count > 0) {
502
+ let suffix = '';
503
+ if (count % 10 === 1 && count % 100 !== 11) suffix = 'отзыв';
504
+ else if (count % 10 >= 2 && count % 10 <= 4 && (count % 100 < 10 || count % 100 >= 20)) suffix = 'отзыва';
505
+ else suffix = 'отзывов';
506
+ html += `<div class="examples-category"><h4>${emotion} (${count} ${suffix})</h4>`;
507
  for (const ex of examples) {
508
  html += `
509
  <div class="example-item">