Skip to content

Bad filter.js v1.0 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 44 commits into
base: BadFilter.js-V1.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
32469f9
badword.js
LcfherShell Oct 9, 2024
2b8f29d
badword.js
LcfherShell Oct 9, 2024
58f6d72
badword.js
LcfherShell Oct 12, 2024
7f02a17
badword.js
LcfherShell Oct 12, 2024
39785c2
badword.js
LcfherShell Oct 12, 2024
7e3f07b
badword.js
LcfherShell Oct 12, 2024
8217586
badword.js
LcfherShell Oct 12, 2024
d05d815
badword.js
LcfherShell Oct 12, 2024
c8fd090
README.md
LcfherShell Oct 12, 2024
f37270e
README.md
LcfherShell Oct 12, 2024
357d796
badword.js
LcfherShell Oct 12, 2024
99e8f1a
README.md
LcfherShell Oct 12, 2024
9ecf5b4
README.md
LcfherShell Oct 12, 2024
38eac9f
badword.js
LcfherShell Oct 12, 2024
a629174
badword.js
LcfherShell Oct 12, 2024
0d734a7
badword.js
LcfherShell Oct 12, 2024
c02537b
badword.js
LcfherShell Oct 12, 2024
0057e67
badword.js
LcfherShell Oct 12, 2024
3704e7c
badword.js
LcfherShell Oct 12, 2024
2726c10
badword.js
LcfherShell Oct 12, 2024
281088e
badword.js
LcfherShell Oct 12, 2024
9efb9b5
badword.js
LcfherShell Oct 12, 2024
599707e
badword.js
LcfherShell Oct 12, 2024
33e2f40
badword.js
LcfherShell Oct 12, 2024
ff66b5c
README.md
LcfherShell Oct 12, 2024
84d10d6
badword.js
LcfherShell Oct 13, 2024
8ceb651
Create node.js.yml
LcfherShell Oct 13, 2024
1fc5e18
node.js.yml
LcfherShell Oct 13, 2024
a06a6d1
node.js.yml
LcfherShell Oct 13, 2024
b4c4b6a
node.js.yml
LcfherShell Oct 13, 2024
706f1ca
node.js.yml
LcfherShell Oct 13, 2024
620b606
node.js.yml
LcfherShell Oct 13, 2024
2e033fd
package.json
LcfherShell Oct 13, 2024
bf649f1
package.json
LcfherShell Oct 13, 2024
2dece10
package.json
LcfherShell Oct 13, 2024
752f30e
node.js.yml
LcfherShell Oct 13, 2024
800fac1
Delete .github/workflows directory
LcfherShell Oct 13, 2024
e8c6d4f
Create node.js.yml
LcfherShell Oct 13, 2024
535773a
Update node.js.yml
LcfherShell Oct 13, 2024
e0b4bee
Create badword.ts
LcfherShell Oct 13, 2024
4baad94
Update badword.ts
LcfherShell Oct 13, 2024
605efcf
Update badword.ts
LcfherShell Oct 13, 2024
2a65e28
Update badword.ts
LcfherShell Oct 13, 2024
34268fa
Create tsconfig.json
LcfherShell Oct 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Setup Modules

on:
push:
branches: [ "BadFilter.js-V1.0" ]
pull_request:
branches: [ "BadFilter.js-V1.0" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test
110 changes: 98 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,101 @@
<BadFilter.js>
## 🎉 **Welcome to BadFilter.js!** 🎉

```Javascript hl_lines="4 9-12 25-27"
Tired of offensive language in your app? 🚫 **BadFilter.js** to the rescue! We’ve crafted a supercharged, customizable solution that helps developers filter out inappropriate words like a pro. Let's make the internet a friendlier place one word at a time! 🌐💬

---

## 🛠️ **Overview**

**BadFilter.js** offers two powerful components:
- **FilterBadWord Class**: The brains of the operation! This utility class is responsible for filtering unwanted words from your text.
- **filters_badword Function**: A lightweight wrapper around `FilterBadWord` for easier, more streamlined usage. Think of it as the "express mode" for your text-filtering needs!

With these components, you can easily cleanse your text, ensuring a respectful, safe online environment. 🚀✨

---

## 🔧 **How It Works**
Both **FilterBadWord** and **filters_badword** combine Natural Language Processing (NLP) and Machine Learning (ML) for *accurate* and *intelligent* word filtering.

Here's the breakdown of the magic:
1. **Tokenization**: Your text gets split into individual words (tokens) 🧩.
2. **NLP Analysis**: The tokens are scanned using cutting-edge NLP algorithms to sniff out those pesky bad words 🕵️‍♂️.
3. **Machine Learning**: Filtering gets smarter with each interaction, ensuring those inappropriate words vanish into thin air ✨.
4. **Customization**: Want to fine-tune the filter to match your app's personality? You got it! Use the handy config method to tweak things to perfection 🎛️.

---

## 🚀 **Getting Started**

### 1️⃣ **HTML Setup**
Want to use BadFilter.js in your web app? No problem! Here’s how:
```html
<!-- Add badword.js into the HTML page -->
<script type="text/javascript" src="./badword.js"></script>
<!-- Or import directly if supporting ES Module -->
<script type="module" src="./badword.js">
</script>

<script>
const badfilter = new FilterBadWord("FUck master");
console.log(badfilter.clean(badfilter.position())); // Output: ***** master
</script>
```
Easy peasy, right? 🍋

### 2️⃣ **Node.js Setup**
If you’re working on a Node.js project, just use this:
```javascript
const { FilterBadWord, filters_badword } = require('./badword.js');

// Express filtering using filters_badword
const badfilter = new FilterBadWord("FUck master");
console.log(badfilter.clean(badfilter.position())); // Output: ***** master
```

### 🎯 **Pro Mode: filters_badword Class**
For full control over filtering, dive into the **filters_badword** class:
```javascript
const badfilt = new filters_badword();
badfilt.config(true, false); //accpet filter and error print
badfilt.words_o("FUck master");
console.log( badfilt.cleans );
console.log( badfilt.position() );
//result ***** master

badfilt.words_o("motherfucker");
console.log( badfilt.cleans );
console.log( badfilt.position() );
//result *************
badfilt.config(true, false); // Custom filtering settings
badfilt.text_o("FUck master"); // Censored output: ***** master
console.log(badfilt.cleans);
console.log(badfilt.position()); // Shows position of the bad word

badfilt.text_o("motherfucker");
console.log(badfilt.cleans); // Output: *************
console.log(badfilt.position());
```

🔧 **Config it your way!** Customize how strict or lenient your filter should be using `.config()`. Want more control? You got it!

---

## 💡 **Features You'll Love**

### 🧠 **Smart Filtering**
Thanks to the NLP + ML combo, your filters get sharper over time, catching even the sneakier bad words. Say goodbye to offensive content! 🙅‍♂️🚫

### 🎨 **Fully Customizable**
Want to allow certain words or apply extra strict filtering? Adjust it with ease. You’re in the driver’s seat of how clean your app should be. Customize the experience and make it yours! 🛠️

### ⚡ **Blazing Fast**
We know speed matters! BadFilter.js is optimized to perform like a ninja—fast and precise. Your users won’t even notice the filtering happening in the background. 🌪️

---

## 🤔 **Why Choose BadFilter.js?**

- **Accuracy**: Spot-on detection of offensive words using cutting-edge algorithms 🎯.
- **Customizable**: Shape the filter to match your app’s personality 🎛️.
- **Safe Spaces**: Build a more positive, respectful community 🌸.

Whether you're building a chat app, a forum, or an online game, **BadFilter.js** will ensure everyone has a good time without the drama! 🎉

---

## 🎬 **Wrap-Up**

With **BadFilter.js**, you're one step closer to making the internet a more positive place. Say goodbye to offensive language and hello to a world of friendly interactions. Let's get filtering, and have some fun while we're at it! ✨

Go on, give it a spin and watch the magic unfold in your app! 🚀
Loading
Loading