-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,39 @@ | |
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Bad Word Checker</title> | ||
<title>Nirmol: Bangla Offensive Language Detection API and Dataset</title> | ||
<!-- Bootstrap CSS --> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"> | ||
<style> | ||
/* Additional custom CSS */ | ||
.container { | ||
max-width: 500px; | ||
margin-top: 50px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>Bad Word Checker</h1> | ||
<input type="text" id="textInput" placeholder="Enter your text here"> | ||
<button onclick="checkBadWords()">Check</button> | ||
<div id="result"></div> | ||
<div class="container"> | ||
<h1 class="text-center">Nirmol</h1> | ||
<p class="text-center">Nirmol (নির্মল) is a Bangla Offensive Language Detection API and Dataset</p> | ||
<div class="input-group mb-3"> | ||
<input type="text" class="form-control" id="textInput" placeholder="Enter your text here" oninput="toggleButton()"> | ||
<button class="btn btn-primary" id="checkButton" onclick="checkBadWords()" disabled>Check</button> | ||
</div> | ||
<div id="result"></div> | ||
<img class="img-thumbnail img-fluid" src="/nirmol.png" alt="" srcset=""> | ||
</div> | ||
|
||
<!-- Bootstrap JS (optional if you're not using JS features from Bootstrap) --> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> | ||
|
||
<script> | ||
function toggleButton() { | ||
const inputText = document.getElementById('textInput').value.trim(); | ||
const checkButton = document.getElementById('checkButton'); | ||
checkButton.disabled = inputText === ''; | ||
} | ||
|
||
function checkBadWords() { | ||
const inputText = document.getElementById('textInput').value; | ||
fetch(`https://nirmol.cyclic.app/${encodeURIComponent(inputText)}`) | ||
|
@@ -21,17 +45,17 @@ <h1>Bad Word Checker</h1> | |
resultDiv.innerHTML = ''; | ||
|
||
if (data.bad_sentence) { | ||
resultDiv.innerHTML += '<p>This sentence contains bad words:</p>'; | ||
resultDiv.innerHTML += '<div class="alert alert-danger" role="alert">This sentence contains bad words:</div>'; | ||
resultDiv.innerHTML += `<p>Bad words: ${data.bad_word_list.join(', ')}</p>`; | ||
resultDiv.innerHTML += `<p>Normal words: ${data.normal_words.join(', ')}</p>`; | ||
resultDiv.innerHTML += `<p>Badness: ${data.badness}</p>`; | ||
} else { | ||
resultDiv.innerHTML = '<p>No bad words found in the sentence.</p>'; | ||
resultDiv.innerHTML = '<div class="alert alert-success" role="alert">No bad words found in the sentence.</div>'; | ||
} | ||
}) | ||
.catch(error => { | ||
console.error('Error:', error); | ||
document.getElementById('result').innerHTML = '<p>An error occurred. Please try again later.</p>'; | ||
document.getElementById('result').innerHTML = '<div class="alert alert-danger" role="alert">An error occurred. Please try again later.</div>'; | ||
}); | ||
} | ||
</script> | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.