glin-profanity 1.1.9 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,100 @@
1
-
2
- # Glin Profanity
3
- Glin-Profanity is a lightweight and efficient npm package designed to detect and filter profane language in text inputs across multiple languages. Whether you’re building a chat application, a comment section, or any platform where user-generated content is involved, Glin-Profanity helps you maintain a clean and respectful environment.
1
+ <p align="center">
2
+ <a href="https://www.glincker.com/tools/glin-profanity" target="_blank">
3
+ <img src="../../assets/glinr-logo.png" alt="Glin Profanity" width="40" />
4
+ </a>
5
+ </p>
6
+
7
+ <h1 align="center">GLIN PROFANITY</h1>
8
+
9
+ <p align="center">
10
+ <strong>A multilingual profanity detection and filtering engine for modern applications — by <a href="https://glincker.com">GLINCKER</a></strong>
11
+ </p>
12
+ <p align="center">
13
+ <a href="https://www.glincker.com/tools/glin-profanity">
14
+ <img src="https://img.shields.io/badge/🚀%20Try%20Live%20Demo-online-blue" alt="Try Live Demo" />
15
+ </a>
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="https://www.npmjs.com/package/glin-profanity">
20
+ <img src="https://img.shields.io/npm/v/glin-profanity" alt="NPM Version" />
21
+ </a>
22
+ <a href="https://github.com/GLINCKER/glin-profanity/blob/main/LICENSE">
23
+ <img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License" />
24
+ </a>
25
+ <a href="https://github.com/GLINCKER/glin-profanity/actions">
26
+ <img src="https://img.shields.io/github/actions/workflow/status/GLINCKER/glin-profanity/ci.yml" alt="CI Status" />
27
+ </a>
28
+ <a href="https://www.npmjs.com/package/glin-profanity">
29
+ <img src="https://img.shields.io/npm/dw/glin-profanity" alt="Weekly Downloads" />
30
+ </a>
31
+ <a href="https://github.com/GLINCKER/glin-profanity/issues">
32
+ <img src="https://img.shields.io/github/issues/GLINCKER/glin-profanity" alt="Open Issues" />
33
+ </a>
34
+ <a href="https://github.com/GLINCKER/glin-profanity/pulls">
35
+ <img src="https://img.shields.io/github/issues-pr/GLINCKER/glin-profanity" alt="Open PRs" />
36
+ </a>
37
+ <a href="https://github.com/GLINCKER/glin-profanity/commits/main">
38
+ <img src="https://img.shields.io/github/last-commit/GLINCKER/glin-profanity" alt="Last Commit" />
39
+ </a>
40
+ <a href="https://github.com/GLINCKER/glin-profanity/stargazers">
41
+ <img src="https://img.shields.io/github/stars/GLINCKER/glin-profanity" alt="GitHub Stars" />
42
+ </a>
43
+ <a href="https://github.com/GLINCKER/glin-profanity/network/members">
44
+ <img src="https://img.shields.io/github/forks/GLINCKER/glin-profanity" alt="GitHub Forks" />
45
+ </a>
46
+ <a href="https://github.com/GLINCKER/glin-profanity/graphs/contributors">
47
+ <img src="https://img.shields.io/github/contributors/GLINCKER/glin-profanity" alt="Contributors" />
48
+ </a>
49
+ <a href="#-table-of-contents">
50
+ <img src="https://img.shields.io/badge/-Table%20of%20Contents-blue" alt="Table Of Contents" />
51
+ </a>
52
+ </p>
53
+
54
+ ---
55
+
56
+
57
+ > A multilingual profanity detection and filtering engine for modern applications — by [GLINCKER](https://glincker.com)
58
+
59
+ [![Glin Profanity Preview](../../assets/glin-profanity-preview.png)](https://www.glincker.com/tools/glin-profanity)
60
+
61
+ ---
62
+
63
+ ## ✨ Overview
64
+
65
+ **Glin-Profanity** is a high-performance JavaScript/TypeScript library built to detect, filter, and sanitize profane or harmful language in user-generated content. With support for over 20+ languages, configurable severity levels, obfuscation detection, and real-time React integration, it’s designed for developers who care about building safe, inclusive platforms.
66
+
67
+ Whether you're moderating chat messages, community forums, or content input forms, Glin-Profanity empowers you to:
68
+
69
+ - 🧼 Filter text with real-time or batch processing
70
+ - 🗣️ Detect offensive terms in **20+ human languages**
71
+ - 💬 Catch obfuscated profanity like `sh1t`, `f*ck`, `a$$hole`
72
+ - 🎚️ Adjust severity thresholds (`Exact`, `Fuzzy`, `Merged`)
73
+ - 🔁 Replace bad words with symbols or emojis
74
+ - 🧩 Seamlessly integrate into **React apps** via `useProfanityChecker`
75
+ - 🛡️ Add custom word lists or ignore specific terms
76
+
77
+ ## 📚 Table of Contents
78
+
79
+ - [🚀 Features](#-features)
80
+ - [📦 Installation](#installation)
81
+ - [🌍 Supported Languages](#supported-languages)
82
+ - [⚙️ Usage](#usage)
83
+ - [Basic Usage](#basic-usage)
84
+ - [🧠 API](#api)
85
+ - [Filter Class](#filter-class)
86
+ - [Constructor](#constructor)
87
+ - [FilterConfig Options](#filterconfig-options)
88
+ - [Methods](#methods)
89
+ - [isProfane](#isprofane)
90
+ - [checkProfanity](#checkprofanity)
91
+ - [useProfanityChecker Hook](#useprofanitychecker-hook)
92
+ - [Parameters](#parameters)
93
+ - [Return Value](#return-value)
94
+ - [⚠️ Note](#note)
95
+ - [🛠 Use Cases](#-use-cases)
96
+ - [📄 License](#license)
97
+ - [MIT License](#mit-license)
4
98
 
5
99
  ## Installation
6
100
 
@@ -14,61 +108,60 @@ OR
14
108
  ```bash
15
109
  yarn add glin-profanity
16
110
  ```
111
+
112
+ ### Supported Languages
113
+
114
+ Arabic, Chinese, Czech, Danish, English, Esperanto, Finnish, French, German, Hindi, Hungarian, Italian, Japanese, Korean, Norwegian, Persian, Polish, Portuguese, Russian, Turkish, Swedish, Thai
115
+
17
116
  ## Usage
18
117
 
19
118
  ### Basic Usage
20
119
 
21
120
  Here's a simple example of how to use Glin-Profanity in a React application:
22
121
 
23
- ```typescript
122
+ ```tsx
24
123
  import React, { useState } from 'react';
25
- import { useProfanityChecker, Language } from 'glin-profanity';
124
+ import { useProfanityChecker, SeverityLevel, Language } from 'glin-profanity';
26
125
 
27
- const App: React.FC = () => {
126
+ const App = () => {
28
127
  const [text, setText] = useState('');
29
- const [checkAllLanguages, setCheckAllLanguages] = useState(false);
30
- const { result, checkText } = useProfanityChecker(
31
- checkAllLanguages ? { allLanguages: true } : { languages: ['english', 'french'] }
32
- );
33
-
34
- const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
35
- setText(e.target.value);
36
- };
37
-
38
- const handleCheck = () => {
39
- checkText(text);
40
- };
128
+ const [autoReplace, setAutoReplace] = useState(true);
129
+ const [replaceWith, setReplaceWith] = useState('***');
130
+ const [minSeverity, setMinSeverity] = useState(SeverityLevel.Exact);
131
+
132
+ const { result, checkText } = useProfanityChecker({
133
+ allLanguages: true,
134
+ severityLevels: true,
135
+ autoReplace,
136
+ replaceWith,
137
+ minSeverity,
138
+ customActions: (res) => {
139
+ console.log('[Detected]', res.profaneWords);
140
+ },
141
+ });
41
142
 
42
143
  return (
43
144
  <div>
44
- <h1>Welcome to Glin-Profanity</h1>
45
- <input type="text" value={text} onChange={handleChange} />
46
- <button onClick={handleCheck}>Check Profanity</button>
47
- <div>
48
- <label>
49
- <input
50
- type="checkbox"
51
- checked={checkAllLanguages}
52
- onChange={(e) => setCheckAllLanguages(e.target.checked)}
53
- />
54
- Check All Languages
55
- </label>
56
- </div>
145
+ <input value={text} onChange={(e) => setText(e.target.value)} />
146
+ <button onClick={() => checkText(text)}>Scan</button>
147
+
57
148
  {result && (
58
- <div>
149
+ <>
59
150
  <p>Contains Profanity: {result.containsProfanity ? 'Yes' : 'No'}</p>
60
151
  {result.containsProfanity && (
61
- <p>Profane Words: {result.profaneWords.join(', ')}</p>
152
+ <>
153
+ <p>Detected: {result.profaneWords.join(', ')}</p>
154
+ <p>Replaced: {result.processedText}</p>
155
+ </>
62
156
  )}
63
- </div>
157
+ </>
64
158
  )}
65
159
  </div>
66
160
  );
67
161
  };
68
-
69
- export default App;
70
162
  ```
71
163
 
164
+
72
165
  ## API
73
166
 
74
167
  ### `Filter` Class
@@ -89,16 +182,26 @@ new Filter(config?: {
89
182
  });
90
183
  ```
91
184
 
92
- - `config`: An optional configuration object.
93
- - `languages`: An array of languages to check for profanities.
94
- - `allLanguages`: A boolean indicating whether to check for all languages.
95
- - `caseSensitive`: A boolean indicating whether the profanity check should be case-sensitive.
96
- - `wordBoundaries`: A boolean indicating whether to consider word boundaries when checking for profanities.
97
- - `customWords`: An array of custom words to include in the profanity check.
98
- - `replaceWith`: A string to replace profane words with.
99
- - `severityLevels`: A boolean indicating whether to include severity levels for profane words.
100
- - `ignoreWords`: An array of words to ignore in the profanity check.
101
- - `logProfanity`: A boolean indicating whether to log detected profane words.
185
+ #### FilterConfig Options:
186
+
187
+ | Option | Type | Description |
188
+ |-------------------------|--------------------|-------------|
189
+ | `languages` | `Language[]` | Languages to include |
190
+ | `allLanguages` | `boolean` | If true, scan all available languages |
191
+ | `caseSensitive` | `boolean` | Match case exactly |
192
+ | `wordBoundaries` | `boolean` | Only match full words (turn off for substring matching) |
193
+ | `customWords` | `string[]` | Add your own words |
194
+ | `replaceWith` | `string` | Replace matched words with this string |
195
+ | `severityLevels` | `boolean` | Enable severity mapping (Exact, Fuzzy, Merged) |
196
+ | `ignoreWords` | `string[]` | Words to skip even if found |
197
+ | `logProfanity` | `boolean` | Log results via console |
198
+ | `allowObfuscatedMatch` | `boolean` | Enable fuzzy pattern matching like `f*ck` |
199
+ | `fuzzyToleranceLevel` | `number (0–1)` | Adjust how tolerant fuzzy matching is |
200
+ | `autoReplace` | `boolean` | Whether to auto-replace flagged words |
201
+ | `minSeverity` | `SeverityLevel` | Minimum severity to include in final list |
202
+ | `customActions` | `(result) => void` | Custom logging/callback support |
203
+
204
+ ---
102
205
 
103
206
  #### Methods
104
207
 
@@ -156,6 +259,17 @@ A custom React hook for using the profanity checker.
156
259
  const { result, checkText, checkTextAsync } = useProfanityChecker(config);
157
260
  ```
158
261
 
262
+ ## Note
263
+ ⚠️ Glin-Profanity is a best-effort tool. Language evolves, and no filter is perfect. Always supplement with human moderation for high-risk platforms.
264
+
265
+ ## 🛠 Use Cases
266
+
267
+ - 🔐 Chat moderation in messaging apps
268
+ - 🧼 Comment sanitization for blogs or forums
269
+ - 🕹️ Game lobbies & multiplayer chats
270
+ - 🤖 AI content filters before processing input
271
+
272
+
159
273
  ## License
160
274
 
161
275
  This software is also available under the GLINCKER LLC proprietary license. The proprietary license allows for use, modification, and distribution of the software with certain restrictions and conditions as set forth by GLINCKER LLC.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "words": [
3
- "testbad01",
4
- "2g1c",
5
3
  "2 girls 1 cup",
4
+ "2g1c",
5
+ "a$$",
6
6
  "acrotomophilia",
7
7
  "alabama hot pocket",
8
8
  "alaskan pipeline",
@@ -12,10 +12,13 @@
12
12
  "apeshit",
13
13
  "arsehole",
14
14
  "ass",
15
+ "asshat",
15
16
  "asshole",
16
17
  "assmunch",
18
+ "asswipe",
17
19
  "auto erotic",
18
20
  "autoerotic",
21
+ "b!tch",
19
22
  "babeland",
20
23
  "baby batter",
21
24
  "baby juice",
@@ -30,6 +33,7 @@
30
33
  "barely legal",
31
34
  "barenaked",
32
35
  "bastard",
36
+ "bastardized",
33
37
  "bastardo",
34
38
  "bastinado",
35
39
  "bbw",
@@ -50,9 +54,9 @@
50
54
  "black cock",
51
55
  "blonde action",
52
56
  "blonde on blonde action",
53
- "blowjob",
54
57
  "blow job",
55
58
  "blow your load",
59
+ "blowjob",
56
60
  "blue waffle",
57
61
  "blumpkin",
58
62
  "bollocks",
@@ -63,6 +67,7 @@
63
67
  "booty call",
64
68
  "brown showers",
65
69
  "brunette action",
70
+ "bs",
66
71
  "bukkake",
67
72
  "bulldyke",
68
73
  "bullet vibe",
@@ -88,11 +93,12 @@
88
93
  "clusterfuck",
89
94
  "cock",
90
95
  "cocks",
96
+ "cocksucker",
97
+ "coon",
98
+ "coons",
91
99
  "coprolagnia",
92
100
  "coprophilia",
93
101
  "cornhole",
94
- "coon",
95
- "coons",
96
102
  "creampie",
97
103
  "cum",
98
104
  "cumming",
@@ -106,15 +112,16 @@
106
112
  "dendrophilia",
107
113
  "dick",
108
114
  "dildo",
109
- "dingleberry",
110
115
  "dingleberries",
116
+ "dingleberry",
117
+ "dipshit",
111
118
  "dirty pillows",
112
119
  "dirty sanchez",
120
+ "dog style",
113
121
  "doggie style",
114
122
  "doggiestyle",
115
123
  "doggy style",
116
124
  "doggystyle",
117
- "dog style",
118
125
  "dolcett",
119
126
  "domination",
120
127
  "dominatrix",
@@ -124,6 +131,7 @@
124
131
  "double penetration",
125
132
  "dp action",
126
133
  "dry hump",
134
+ "dumbass",
127
135
  "dvda",
128
136
  "eat my ass",
129
137
  "ecchi",
@@ -132,6 +140,8 @@
132
140
  "erotism",
133
141
  "escort",
134
142
  "eunuch",
143
+ "f*ck",
144
+ "f@ck",
135
145
  "faggot",
136
146
  "fecal",
137
147
  "felch",
@@ -148,12 +158,16 @@
148
158
  "frotting",
149
159
  "fuck",
150
160
  "fuck buttons",
161
+ "fucker",
162
+ "fuckface",
151
163
  "fuckin",
152
164
  "fucking",
153
165
  "fucktards",
154
166
  "fudge packer",
155
167
  "fudgepacker",
168
+ "fuq",
156
169
  "futanari",
170
+ "g-spot",
157
171
  "gang bang",
158
172
  "gay sex",
159
173
  "genitals",
@@ -166,18 +180,18 @@
166
180
  "god damn",
167
181
  "gokkun",
168
182
  "golden shower",
169
- "goodpoop",
170
183
  "goo girl",
184
+ "goodpoop",
171
185
  "goregasm",
172
186
  "grope",
173
187
  "group sex",
174
- "g-spot",
175
188
  "guro",
176
189
  "hand job",
177
190
  "handjob",
178
191
  "hard core",
179
192
  "hardcore",
180
193
  "hentai",
194
+ "hoe",
181
195
  "homoerotic",
182
196
  "honkey",
183
197
  "hooker",
@@ -190,6 +204,7 @@
190
204
  "incest",
191
205
  "intercourse",
192
206
  "jack off",
207
+ "jackass",
193
208
  "jail bait",
194
209
  "jailbait",
195
210
  "jelly donut",
@@ -207,12 +222,14 @@
207
222
  "leather restraint",
208
223
  "leather straight jacket",
209
224
  "lemon party",
225
+ "lmfao",
210
226
  "lolita",
211
227
  "lovemaking",
212
228
  "make me come",
213
229
  "male squirting",
214
230
  "masturbate",
215
231
  "menage a trois",
232
+ "mf",
216
233
  "milf",
217
234
  "missionary position",
218
235
  "motherfucker",
@@ -224,9 +241,9 @@
224
241
  "nawashi",
225
242
  "negro",
226
243
  "neonazi",
244
+ "nig nog",
227
245
  "nigga",
228
246
  "nigger",
229
- "nig nog",
230
247
  "nimphomania",
231
248
  "nipple",
232
249
  "nipples",
@@ -236,6 +253,7 @@
236
253
  "nympho",
237
254
  "nymphomania",
238
255
  "octopussy",
256
+ "omfg",
239
257
  "omorashi",
240
258
  "one cup two girls",
241
259
  "one guy one jar",
@@ -251,8 +269,9 @@
251
269
  "penis",
252
270
  "phone sex",
253
271
  "piece of shit",
254
- "pissing",
255
272
  "piss pig",
273
+ "pissed",
274
+ "pissing",
256
275
  "pisspig",
257
276
  "playboy",
258
277
  "pleasure chest",
@@ -261,7 +280,6 @@
261
280
  "poof",
262
281
  "poon",
263
282
  "poontang",
264
- "punany",
265
283
  "poop chute",
266
284
  "poopchute",
267
285
  "porn",
@@ -270,6 +288,7 @@
270
288
  "prince albert piercing",
271
289
  "pthc",
272
290
  "pubes",
291
+ "punany",
273
292
  "pussy",
274
293
  "queaf",
275
294
  "queef",
@@ -280,12 +299,15 @@
280
299
  "raping",
281
300
  "rapist",
282
301
  "rectum",
302
+ "retard",
303
+ "retarded",
283
304
  "reverse cowgirl",
284
305
  "rimjob",
285
306
  "rimming",
286
307
  "rosy palm",
287
308
  "rosy palm and her 5 sisters",
288
309
  "rusty trombone",
310
+ "s&m",
289
311
  "sadism",
290
312
  "santorum",
291
313
  "scat",
@@ -295,19 +317,22 @@
295
317
  "sex",
296
318
  "sexo",
297
319
  "sexy",
320
+ "sh!t",
298
321
  "shaved beaver",
299
322
  "shaved pussy",
300
323
  "shemale",
301
324
  "shibari",
302
325
  "shit",
303
326
  "shitblimp",
327
+ "shithead",
328
+ "shitshow",
304
329
  "shitty",
305
330
  "shota",
306
331
  "shrimping",
332
+ "simp",
307
333
  "skeet",
308
334
  "slanteye",
309
335
  "slut",
310
- "s&m",
311
336
  "smut",
312
337
  "snatch",
313
338
  "snowballing",
@@ -319,6 +344,7 @@
319
344
  "spooge",
320
345
  "spread legs",
321
346
  "spunk",
347
+ "stfu",
322
348
  "strap on",
323
349
  "strapon",
324
350
  "strappado",
@@ -333,6 +359,7 @@
333
359
  "tainted love",
334
360
  "taste my",
335
361
  "tea bagging",
362
+ "testbad01",
336
363
  "threesome",
337
364
  "throating",
338
365
  "tied up",
@@ -366,17 +393,18 @@
366
393
  "voyeur",
367
394
  "vulva",
368
395
  "wank",
369
- "wetback",
370
396
  "wet dream",
397
+ "wetback",
371
398
  "white power",
372
399
  "wrapping men",
373
400
  "wrinkled starfish",
401
+ "wtf",
374
402
  "xx",
375
403
  "xxx",
376
404
  "yaoi",
377
405
  "yellow showers",
378
406
  "yiffy",
379
407
  "zoophilia",
380
- "🖕"
408
+ "\ud83d\udd95"
381
409
  ]
382
410
  }
@@ -1,5 +1,5 @@
1
- import { Language, CheckProfanityResult } from '../types/types';
2
- interface FilterConfig {
1
+ import { Language, CheckProfanityResult, SeverityLevel } from '../types/types';
2
+ export interface FilterConfig {
3
3
  languages?: Language[];
4
4
  allLanguages?: boolean;
5
5
  caseSensitive?: boolean;
@@ -9,7 +9,8 @@ interface FilterConfig {
9
9
  severityLevels?: boolean;
10
10
  ignoreWords?: string[];
11
11
  logProfanity?: boolean;
12
- globalWhitelist?: string[];
12
+ allowObfuscatedMatch?: boolean;
13
+ fuzzyToleranceLevel?: number;
13
14
  }
14
15
  declare class Filter {
15
16
  private words;
@@ -19,14 +20,20 @@ declare class Filter {
19
20
  private severityLevels;
20
21
  private ignoreWords;
21
22
  private logProfanity;
22
- private globalWhitelist;
23
+ private allowObfuscatedMatch;
24
+ private fuzzyToleranceLevel;
23
25
  constructor(config?: FilterConfig);
26
+ private debugLog;
27
+ private normalizeObfuscated;
24
28
  private getRegex;
25
- private isFuzzyMatch;
26
- private isMergedMatch;
29
+ private isFuzzyToleranceMatch;
27
30
  private evaluateSeverity;
28
31
  isProfane(value: string): boolean;
29
- checkProfanityInSentence(text: string): CheckProfanityResult;
32
+ matches(word: string): boolean;
30
33
  checkProfanity(text: string): CheckProfanityResult;
34
+ checkProfanityWithMinSeverity(text: string, minSeverity?: SeverityLevel): {
35
+ filteredWords: string[];
36
+ result: CheckProfanityResult;
37
+ };
31
38
  }
32
39
  export { Filter };