-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
527 lines (482 loc) · 26.7 KB
/
index.html
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
<!DOCTYPE html>
<html>
<head>
<!-- Meta & Stylesheet Links -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="https://unpkg.com/[email protected]/css/boxicons.min.css" rel="stylesheet" />
<link href="./assets/mlthsc-fav.png" rel="icon" type="image/x-icon" />
<link rel="stylesheet" href="style.css">
<title>MLTHSC | Multilabel Tagalog Hate Speech Classifier</title>
</head>
<body>
<div>
<!-- <p id="status">Status</p> -->
</div>
<!-- Header Section -->
<header>
<nav class="flex">
<!-- Logo Section -->
<div class="logo">
<img class="logo-img" src="./assets/mlthsc.png" style="width: 20px;" alt="mlthsc logo" />
<h2 class="logo-name">mlthsc.</h2>
</div>
<!-- Dark Mode Toggle -->
<!-- <div class="dark-mode-toggle">
<input type="checkbox" id="dark-mode-toggle" onclick="toggleDarkMode()" />
<label for="dark-mode-toggle"></label>
</div> -->
<ul>
<a href="https://github.com/syke9p3/mlthsc-thesis" target="_blank">
<button class="btn btn-nav">
<i class='bx bxl-github'></i>
<span>Source Code</span>
</button>
</a>
</ul>
</nav>
</header>
<main class="" id="main-container">
<!-- Introduction and Instructions -->
<section class="banner-section">
<div class="banner container">
<h1 class="banner-title" style=" color: var(--text-inverse);">
Multilabel Tagalog Hate Speech Classifier
</h1>
<p class="text-secondary" id="input-post-description" style="display: block; color: #EFF1F5;">
Enter Tagalog
<span class="tooltip">
hate speech
<span class="tooltiptext">
Speech that promotes violence or discrimination against
individuals or groups based on attributes such as gender, race,
religion, physical appearance, disability, etc. that can lead to
deterioration of ones health.
</span>
</span>
text in the textbox below. Press the <b>Classify</b> button to
categorize the input hate speech based on <span class="tooltip">
different labels
<span class="tooltiptext">
Age, Gender, Physical, Race, Religion, Others.
</span>
</span>. The classifier
accepts a text input from <b>15 characters</b> up to <b>280 characters</b>.
</p>
</div>
</section>
<!-- Main Content Section -->
<!-- Input Options (Text, Link, Upload File, Upload Image) -->
<div class="input-set-wrapper">
<section class="input-set">
<!-- Input Post Tab -->
<div class="input-textbox " id="input-section">
<textarea type="text" id="input-text" placeholder="Enter hate speech" value=""></textarea>
<div class="flex">
<!-- Sample Hate Speech Dropdown -->
<div id="sample-hate-speech-container">
<select id="sample-hate-speech">
<option selected disabled>Select a Sample Hate Speech</option>
<option
value="bading tangina ka masahol ka pa sa hayop na feeling banal catholic fuckers kahoy lang yang sinasamba nyo">
Example 1
</option>
<option value="tangina kang panget na intsik ka ang baho mo pang gago ka pakyu">
Example 2
</option>
<option
value="Tangina. Kailan mo kaya ipapasok sa utak mo ang mga binibilin ko. Ang tanga tanga mong bobo ka. Walang common sense ang tanga. Mamatay ka na nga.">
Example 3
</option>
<option
value="Tanginang mga millenials to puro laro inaatupag. Lalo na mga babaeng puro pagpapakapokpok inaasikaso. Ganto na ba future generation ng pinas? Mga walang silbi sa lipunan">
Example 4
</option>
<option
value="Putanginang mga arabo na to. Parang mga tanga magsalita amputa. Balik na kayo sa bansa nyo tangina nyo mga mukhang unggoy na panget.">
Example 5
</option>
</select>
</div>
<!-- Word Count Display -->
<div class="dev dev-container" style="font-family: monospace;">
<span class="word-limit">
<span id="word-count" class="dev">
-
</span>
/ 280 characters
</span>
</div>
</div>
</div>
<div class="toolbar">
<!-- Analyze and Clear Buttons -->
<div class="btn-group">
<!-- Button for Input Post and Upload File -->
<button id="analyze-btn" disabled class="btn btn-options btn-classify">
<i class="bx bx-send"></i> Classify
</button>
<button id="clear-btn" class="btn btn-options btn-clear">
<i class="bx bxs-tag-x"></i> Clear
</button>
</div>
<div class="toaster">
<span id="model-status">Press <b>Classify</b> to activate the hate speech classifier.</span>
</div>
</div>
</div>
</section>
<div class="section output-section" id="output-section">
<section id="output-container" class="">
<!-- <div class="flex justify-between align-center section-header">
<h4 class="label-header">Input Text</h4>
</div> -->
<div class="input-display-container" id="input-display-container">
<div>
<div class="input-display" id="input-display" style="transition: opacity 0.5s;">
<div class="tweet-header">
<div>
<img src="assets/mlthsc.png" width="40px" alt="">
</div>
<div class="tweet-name">
<h4 class="">MLTHSC</h4>
<p>@bert_tagalog</p>
</div>
</div>
<span id="input-display-text">
Enter a Tagalog hate speech text to categorize it as Age, Gender, Physical, Race,
Religion
or Others.
</span>
<span id="input-display-date" class="input-display-date">
<div id="tweet-time">3:41:55 AM</div>
<div class="tweet-date-separator">•</div>
<div id="tweet-date">22 Jan 2023</div>
</span>
</div>
</div>
</div>
<div id="loading-display" style="display: none;">Classifying text...</div>
<div id="output-display"></div>
</section>
<!-- Labels and Results Display Section -->
<section id="label-section" class="" style="flex: 1;">
<div class="flex justify-between align-center section-header" style="padding-bottom: 10px; ">
<h4 class="label-header">Classification</h4>
<button id="save-btn" class="btn btn-secondary">
<i class="bx bxs-save bx-xs"></i> Save
</button>
</div>
<textarea type="text" value="" style="display: none" id="extractedText" disabled></textarea>
<!-- No Labels Container (Displayed when no labels are identified) -->
<div id="no-labels-container" style="display: none">
<div class="analyze_container result-fade-in">
<p>No label identified, try changing the text.</p>
</div>
</div>
<!-- Container for Displaying Labels -->
<div class="labels-container" id="labels-container">
<div class="label-container">
<div class="label border-none">
<span class="label-percent">0.00%</span> Age
</div>
</div>
<div class="label-container">
<div class="label border-none">
<span class="label-percent">0.00%</span> Gender
</div>
</div>
<div class="label-container">
<div class="label border-none">
<span class="label-percent">0.00%</span> Physical
</div>
</div>
<div class="label-container">
<div class="label border-none">
<span class="label-percent">0.00%</span> Race
</div>
</div>
<div class="label-container">
<div class="label border-none">
<span class="label-percent">0.00%</span> Religion
</div>
</div>
<div class="label-container">
<div class="label border-none">
<span class="label-percent">0.00%</span> Others
</div>
</div>
</div>
<!-- Settings Container for Label Display Options -->
<div class="settings-container" id="hide-labels-container" style="display: none">
<button class="btn" id="toggle-labels-btn">
Show Labels below 50% <i class="bx bx-chevron-down"></i>
</button>
</div>
</section>
</div>
<!-- Saved Posts Section -->
<section id="saved-post-section" class="section">
<div class="flex justify-between align-center section-header">
<div class="counter-container">
<div id="saved-posts-counter" class="saved-posts-counter">0</div>
<h4>Saved Posts</h4>
</div>
<div class="toolbar-btn-group">
<div class="dropdown-menu">
<button id="export-btn-dropdown" class="btn btn-secondary btn-dropdown" title="Export as CSV">
<i class="bx bx-export bx-xs"></i>
<span>Export</span>
<i class='bx bx-chevron-down' style="font-size: 16px;"></i>
</button>
<div class="dropdown" aria-hidden="true">
<div role="button" class="export-btn" data-filetype="json">
<p>Export as JSON</p>
</div>
<div role="button" class="export-btn" data-filetype="csv">
<p>Export as CSV</p>
</div>
</div>
</div>
<div class="dropdown-menu">
<button id="sp-btn-dropdown" class="btn btn-secondary btn-dropdown btn-dots">
<i class='bx bx-dots-vertical-rounded'></i>
</button>
<div class="dropdown" aria-hidden="true">
<div role="button" id="sp-btn-delete">
<i class='bx bxs-trash-alt'></i>
<p>Delete all posts</p>
</div>
</div>
</div>
</div>
</div>
<!-- <div id="labelFilterButtons">
<button class="all-filter filterButton active" data-label="">
All Labels
</button>
<i class="bx bx-filter bx-sm" style="transform: rotate(-90deg); opacity: 30%"></i>
<button class="filterButton" data-label="age">Age</button>
<button class="filterButton" data-label="gender">Gender</button>
<button class="filterButton" data-label="physical">Physical</button>
<button class="filterButton" data-label="race">Race</button>
<button class="filterButton" data-label="religion">Religion</button>
<button class="filterButton" data-label="others">Others</button>
</div> -->
<!-- <div id="pagination-controls" class="pagination"></div> -->
</section>
<!-- <!-- Stats --/>
<article id="stats">
<div class="flex justify-between align-center section-header" style="padding-bottom: 10px">
<h4>Most Frequent Labels Based on Saved</h4>
</div>
<!-- No posts Container (Displayed when no labels are identified) --/>
<div id="no-chart-container">
<div class="analyze_container result-fade-in">
<p>No data to analyze.</p>
</div>
</div>
<div id="chart-legend" class="chart-legend" style="display: none">
<div class="chart">
<canvas id="labelPieChart"></canvas>
</div>
<div id="legendContainer" class="legend-container"></div>
</div>
</article> -->
</main>
<section class="section" id="saved-posts">
<!-- Template for savedPost -->
</section>
<div class="faq-container bg-white">
<section class="faq-sections">
<article class="faq">
<div class="qna" style="padding: 24px 24px 48px 0;">
<img src="assets/mlthsc.png" alt="" width="40">
<h2>What is MLTHSC?</h2>
<p style="max-width: 768px;">
Multilabel Tagalog Hate Speech Classifier (MLTHSC) is a free to use AI-powered tool designed to
classify hate speech in Tagalog text according to Age, Gender, Physical, Race, Religion, and
Other categories. It uses a fine-tuned Tagalog Bidirectional Encoder Representation from
Transformers (BERT) model to analyze text and a linear neural network to identify various
categories of hate speech.
</p>
</div>
</article>
<!-- <article class="faq">
<div class="qna" style="background-color: white; padding: 48px 24px;">
<h2>Why MLTHSC is useful?</h2>
<ul class="faq-features">
<p> Hate speech rising social media. contribute to the deterioration of an individual’s mental health,
fueling feelings of worthlessness, depression, anxiety, and isolation. Contibute to improved approach for platform moderators through</p>
<li>
<h3>Automated Detection</h3>
<p>Automatically categgorize Tagalog hate speech across various categories with a click of a button. Given the large volume of malicious content posted online, manual efforts in detecting and reporting hate speech is becoming
increasingly tedious task for moderators, that's why.</p>
</li>
<li>
<h3>Tagalog Language-Specific</h3>
<p>The Philippines - growing in social media landscape more users, along this the proliferation of hate speen in Filipino social media landscape especially during election thats why need Fil-based language specific tools. We also aim to address/contribute low-resourced Filipino</p>
</li>
<li>
<h3>Multilabel Classification</h3>
<p>Current hate speech detection models available for Tagalog hate speech text mostly focus
on
detecting the presence of hate in texts but not on providing fine-grained
categorization.
Hate
speech is a complex phenomenon that may vary in themes and platforms
may require a different response or intervention for various targeted groups.</p>
</li>
</ul>
</div>
</article> -->
<article class="faq" id="faq-categories" style="background-color: #F4F7FC;">
<div class="qna">
<h2>What types of hate speech can MLTHSC detect?</h2>
<p>
MLTHSC can detect hate speech across the following categories:
<ul class="faq-categories">
<li class="age">
<!-- <icon>⏳</icon> -->
<icon><i class='bx bx-hourglass'></i></icon>
<div>
<h4 style="background-color: var(--out-age)">Age</h4>
<p style="padding: 1rem; padding-bottom: 0rem">Target of hate speech
pertains to one's age bracket or demographic</p>
</div>
</li>
<li class="gender">
<!-- <icon>🚻</icon> -->
<icon><i class='bx bx-male-female'></i></icon>
<h4 style="background-color: var(--out-gender)">Gender</h4>
<p>Target of hate speech pertains to gender identity, sex, or sexual orientation</p>
</li>
<li class="physical">
<!-- <icon>🎭</icon> -->
<icon><i class='bx bxs-face'></i></icon>
<h4 style="background-color: var(--out-physical)">Physical</h4>
<p>Target of hate speech pertains to physical attributes or
disabilities</p>
</li>
<li class="race">
<!-- <icon>🧑🏿🤝🧑🏼</icon> -->
<!-- <icon> <icon><i class='bx bx-palette' ></i></icon></icon> -->
<icon><i class='bx bxs-palette'></i></icon>
</icon>
<h4 style="background-color: var(--out-race);">Race</h4>
<p>Target of hate speech pertains to racial background, ethnicity,
or nationality</p>
</li>
<li class="religion">
<!-- <icon>📿</icon> -->
<icon><i class='bx bx-plus-medical'></i></icon>
<h4 style="background-color: var(--out-religion)">Religion</h4>
<p>Target of hate speech pertains to affiliation, belief, and faith to any of the existing
religious or non-religious groups</p>
</li>
<li class="others">
<!-- <icon>❓</icon> -->
<icon><i class='bx bxs-balloon'></i></icon>
<h4 style="background-color: var(--out-other)">Others</h4>
<p>Target of hate speech pertains other topic that is not relevant as Age, Gender, Physical,
Race, or Religion</p>
</li>
</ul>
</p>
</div>
</article>
<article class="faq">
<div class="qna" style="padding: 48px 24px;">
<h2>How does MLTHSC work?</h2>
<p style="max-width: 768px;">
MLTHSC uses a machine learning model based on the BERT architecture fine-tuned on Tagalog
hate speech data. When you input text and press the Classify button, the <span class="tooltip">
quantized model
<span class="tooltiptext">
We used a quantized model for this demo because loading the original model would take
time to load and perform classifications due to its larger size (500+ mb). The model
being quantized means its size was reduced (100+ mb) so that it load and perform faster
inference on phones while maintaining
similar albeit reduced accuracy as the original.
</span>
</span> (hosted on <a
href="https://huggingface.co/syke9p3/bert-multilabel-tagalog-hate-speech-classifier"
target="_blank" style="color: #424BFC;"
title="syke9p3/bert-multilabel-tagalog-hate-speech-classifier">Hugging Face <i
class='bx bx-link-external'></i></a>)
will process the text and
output the probability scores for
each hate speech category. For this demo, we used a 30% threshold to determine if a category is
present in the hate speech text.
</p>
</div>
</article>
</section>
</div>
<!-- Webapp Instructions Section -->
<section class="instruction">
<!-- Floating Dialog Box -->
<!-- Section Header -->
<div class="flex justify-between align-center section-header" style="padding: 10px; border: none"></div>
<!-- Footer -->
<section class="footer">
<div class="wrapper-1024 footer-content">
<div class="footer-description">
<div class="footer-description-1">
<div>
<img src="assets/mlthsc.png" width="40px" alt="">
</div>
<div>
<h4 class="footer-description-title">
MLTHSC: Multilabel Tagalog Hate Speech Classifier
</h4>
<p class="footer-description-text">
Multilabel Tagalog Hate Speech Classifier (MLTHSC) is a free to use AI-powered tool
designed to classify hate speech in Tagalog text according to Age, Gender, Physical,
Race, Religion, and Other categories. It uses a fine-tuned Tagalog BERT model to analyze
text and a neural
network to identify various categories of hate speech.
</p>
</div>
</div>
<div class="footer-description-2">
<h4 class="footer-description-title">Disclaimer</h4>
<p class="footer-description-text">
This website does not collect any user credentials. When a classification result is saved,
it is
only stored
in the localstorage of your
browser's device, so your information remains secure and within your
control.
</p>
</div>
</div>
</div>
<div class="footer-credits">
<div class="wrapper-1024 footer-authors ">
<p class="">© 2024: Thesis Passers</p>
<p class="authors">
<a title="LinkedIn: Kenth Saya-ang" target="_blank"
href="https://www.linkedin.com/in/kenthsaya-ang/">Saya-ang</a> |
<a title="LinkedIn: Denise Julianne Gozum" target="_blank"
href="https://www.linkedin.com/in/gozunellaaa/">Gozum</a> |
<a title="LinkedIn: Mary Grizelle Hamor" target="_blank"
href="https://www.linkedin.com/in/mghamor/">Hamor</a> |
<a title="LinkedIn: Ria Karen Mabansag" target="_blank"
href="https://www.linkedin.com/in/ria-karen-mabansag-a00b29259/">Mabansag</a>
</p>
</div>
</div>
</section>
<!-- JavaScript Files -->
<!-- <script src="./frontend/stls2.js"></script> -->
<!-- <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> -->
<!-- <script src="https://cdn.rawgit.com/naptha/tesseract.js/1.0.10/dist/tesseract.js"></script> -->
<!-- <script src="javascript/saving.js" type/="module"></script> -->
<!-- <script src="/saving.js" type="module"></script> -->
<!-- <script src="javascript/utils.js" type="module"></script> -->
<script src="app.js" type="module"></script>
<!-- <script src="./scripts/saveToLocalStorage.js"></script> -->
<!-- <script src="./scripts/script.js"></script> -->
</body>
<div id="toast-container"></div>
</html>