File size: 5,714 Bytes
af53f00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>NORUS Tool</title>
  <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  <script src="{{ url_for('static', filename='js/script.js') }}"></script>
</head>
<body>
<header>
  <div style="text-align: center; margin-top: 20px;">
    <a href="#" id="logo-link">
      <img id="logo" src="https://i.imgur.com/MT5Sl9h.png" alt="NORUS Logo" style="width: 150px;" />
    </a>
  </div>
  <h1>NORUS Tool</h1>
  <p>Analyze your PDF and discover originality and similarity</p>
</header>

<main>
  <form id="analysisForm" action="/validate" method="POST" enctype="multipart/form-data" onsubmit="startProgress()">
    <label for="analysis_type">Choose Analysis Type:</label>
    <select name="analysis_type" id="analysis_type" required>
      <option value="local">Local Comparison</option>
      <option value="pubmed">PubMed Search</option>
    </select>

    <div id="pubmed-options" style="display: none;">
      <label for="query">PubMed Query:</label>
      <input type="text" name="query" id="query" />

      <label for="year_start">Start Year:</label>
      <input type="number" name="year_start" id="year_start" min="1900" max="2025" value="2000" />

      <label for="year_end">End Year:</label>
      <input type="number" name="year_end" id="year_end" min="1900" max="2025" value="2025" />

      <label for="num_articles">Number of Articles:</label>
      <input type="number" name="num_articles" id="num_articles" min="1" value="10" />
    </div>

    <div id="local-options" style="display: none;">
      <label for="comparison_files">Upload comparison PDFs (select multiple):</label>
      <input type="file" name="comparison_files" id="comparison_files" multiple />
    </div>

    <label for="pdf_file">Upload your main PDF:</label>
    <input type="file" name="pdf_file" id="pdf_file" required />

    <button type="submit">Analyze</button>
  </form>

  <div id="progress-container" style="display: none;">
    <p style="text-align: center;">⏳ Analysis in progress...</p>
    <div id="progress-bar">0%</div>
  </div>

  {% if results %}
  <section>
    <h2>Analysis Results</h2>
    <table>
      <thead>
        <tr>
          <th>Title</th>
          <th>Semantic Similarity (%)</th>
          <th>Token Overlap (%)</th>
          <th>OUI (Originality & Uniqueness Index)</th>
        </tr>
      </thead>
      <tbody>
        {% for result in results %}
        <tr>
          <td style="max-width: 400px; word-wrap: break-word;">{{ result.title }}</td>
          <td>{{ "%.2f"|format(result.similarity) }}</td>
          <td>{{ "%.2f"|format(result.token_overlap) }}</td>
          <td>{{ "%.2f"|format(result.oui) }}</td>
        </tr>
        {% endfor %}
      </tbody>
    </table>

    {% if keywords %}
    <div class="results" style="text-align: center; margin-top: 30px;">
      <h3>πŸ”‘ Common Keywords</h3>
      <p>
        {% for kw, count in keywords %}
          <span style="margin: 5px; font-weight: bold;">{{ kw }} ({{ count }})</span>
        {% endfor %}
      </p>
    </div>
    {% endif %}

    <form action="/download_report" method="post" style="text-align: center; margin-top: 30px;">
      <button type="submit">πŸ“„ Download PDF Report</button>
    </form>

    <div id="chart-container" style="margin-top: 50px;">
      <canvas id="similarityChart"></canvas>
    </div>
  </section>
  {% endif %}
</main>

<footer><p>&copy; 2025 NORUS Tool. All rights reserved.</p></footer>

<script>
  document.addEventListener("DOMContentLoaded", function() {
    const analysisType = document.getElementById("analysis_type");
    const pubmedOptions = document.getElementById("pubmed-options");
    const localOptions = document.getElementById("local-options");

    function toggleOptions() {
      if (analysisType.value === "pubmed") {
        pubmedOptions.style.display = "block";
        localOptions.style.display = "none";
      } else {
        pubmedOptions.style.display = "none";
        localOptions.style.display = "block";
      }
    }

    analysisType.addEventListener("change", toggleOptions);
    toggleOptions();
  });
</script>

{% if results %}
<script>
  new Chart(document.getElementById('similarityChart'), {
    type: 'bar',
    data: {
      labels: {{ results | map(attribute='title') | list | safe }},
      datasets: [
        {
          label: 'Semantic Similarity (%)',
          data: {{ results | map(attribute='similarity') | list | safe }},
          backgroundColor: 'rgba(54, 162, 235, 0.7)',
          borderColor: 'rgba(54, 162, 235, 1)',
          borderWidth: 1
        },
        {
          label: 'Token Overlap (%)',
          data: {{ results | map(attribute='token_overlap') | list | safe }},
          backgroundColor: 'rgba(255, 159, 64, 0.7)',
          borderColor: 'rgba(255, 159, 64, 1)',
          borderWidth: 1
        },
        {
          label: 'OUI (%)',
          data: {{ results | map(attribute='oui') | list | safe }},
          backgroundColor: 'rgba(153, 102, 255, 0.7)',
          borderColor: 'rgba(153, 102, 255, 1)',
          borderWidth: 1
        }
      ]
    },
    options: {
      responsive: true,
      plugins: {
        legend: { position: 'top' },
        tooltip: { mode: 'index', intersect: false }
      },
      scales: {
        y: { beginAtZero: true },
        x: {
          ticks: {
            autoSkip: false,
            maxRotation: 45,
            minRotation: 45
          }
        }
      }
    }
  });
</script>
{% endif %}
</body>
</html>