A lightweight JavaScript library for filtering explicit or inappropriate text.
CensorCore is a lightweight JavaScript library for detecting explicit or inappropriate text using a centralized JSON wordlist. It integrates with a single script tag and one function call.
View the full project on GitHub:
CensorCore Repository
Type a message below. If it contains a blocked word, it will be rejected.
wordlist.json file contains explicit language, slurs, and other harmful content. View it at your own risk.
CensorCore is a lightweight JavaScript library for detecting explicit or inappropriate text using a centralized JSON wordlist. It is designed for straightforward integration: include a single script tag and call one function within your message handling logic. CensorCore is suitable for chat applications, comment systems, forms, or any environment where user‑generated text requires screening.
To install CensorCore, include the script tag in the <head> of your HTML file to ensure it loads before your application code:
<script src="https://cdn.jsdelivr.net/gh/DerrickRichard/CensorCore-Library@latest/CensorCore.js"></script>
The library will load after your code if you place it near the closing </html> tag, causing it to fail.
After the script loads, a global object named censor becomes available.
Make sure your internet connection allows loading scripts from the CDN: cdn.jsdelivr.net.
Inside your message‑sending logic, add:
// Block explicit messages using the CensorCore library
if (censor.isBlocked(text)) {
alert("Message blocked: Inappropriate Content");
return;
}
Your full send function may look like this:
function sendMessage() {
const text = input.value;
// Block explicit messages using the CensorCore library
if (censor.isBlocked(text)) {
alert("Message blocked: Inappropriate Content");
return;
}
addMessage(text);
input.value = '';
input.focus();
}
You may also host the script locally:
<script src="path/to/CensorCore.js"></script>
This setup requires no additional configuration and works out of the box.
Call censor.isBlocked(text) before sending or processing a message.
function sendMessage() {
const text = input.value;
// Check if the message contains blocked words
if (censor.isBlocked(text)) {
alert("Message blocked: Inappropriate Content");
return; // Prevent sending the message
}
// Proceed with sending the message
addMessage(text);
}
Ensure you call censor.isBlocked(text) before sending or processing the message.
If it returns true, block the message and notify the user.
CensorCore loads a JSON file structured by category:
{
"profanity": ["word1", "word2"],
"hate_speech": ["word3", "word4"],
"harassment": ["word5", "word6"]
}
All categories are automatically merged into a single internal list. The wordlist is curated solely by Derrick Richard to ensure consistency and quality. Community members cannot directly edit the list; requests may be submitted via the repository’s Discussions page.
Returns true if the provided text contains any banned words. Returns false otherwise.
CensorCore intentionally avoids modifying the host page’s DOM, intercepting events, or altering UI behavior. Instead, it provides a clear and predictable function that developers can integrate into their own message‑handling logic. This ensures transparency, stability, and compatibility across a wide range of applications.
CensorCore was created and is maintained by Derrick Richard, a high‑school developer focused on building practical, lightweight tools for the web. He publishes weekly programming articles on dev.to. More information is available on his personal profile:
https://derrickrichard.github.io/profile/
Released under the MIT License.
All published versions of CensorCore.
Initial release with basic filtering functionality and a basic JSON wordlist.
View Release on GitHubCensorCore v1.1.0 makes the filtering engine faster and more dependable. The wordlist is now processed ahead of time, the matching is quicker, and the library handles text in a more consistent way. The code has also been cleaned up so it is easier to follow and maintain. This update adds a couple of small helper functions that let you check whether the wordlist has loaded or if something went wrong while loading it. The public API is locked so it cannot be changed by accident, and the library behaves more safely if it is used before it finishes loading. Overall, this release makes CensorCore smoother and more reliable without changing how you already use it.
View Release on GitHubDerrick Richard is a student developer from Poth, Texas (Class of 2029) who specializes in building lightweight, practical web tools.