allprofanity 2.2.1 → 2.3.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 +144 -25
- package/allprofanity.config.example.json +6 -0
- package/bin/init.js +1 -1
- package/bin/mcp.js +6 -0
- package/config.schema.json +44 -0
- package/dist/algos/aho-corasick.d.ts +11 -1
- package/dist/algos/aho-corasick.js +31 -6
- package/dist/algos/aho-corasick.js.map +1 -1
- package/dist/algos/bloom-filter.d.ts +2 -2
- package/dist/algos/bloom-filter.js +6 -6
- package/dist/algos/bloom-filter.js.map +1 -1
- package/dist/index.d.ts +131 -11
- package/dist/index.js +736 -126
- package/dist/index.js.map +1 -1
- package/dist/languages/hindi-words.js +2 -2
- package/dist/languages/hindi-words.js.map +1 -1
- package/dist/mcp/server.d.ts +30 -0
- package/dist/mcp/server.js +364 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/stdio.d.ts +1 -0
- package/dist/mcp/stdio.js +72 -0
- package/dist/mcp/stdio.js.map +1 -0
- package/examples-config/README.md +113 -0
- package/examples-config/chat-app.json +24 -0
- package/examples-config/content-moderation.json +42 -0
- package/examples-config/family-friendly-max.json +33 -0
- package/examples-config/high-throughput-api.json +29 -0
- package/examples-config/low-latency-minimal.json +24 -0
- package/examples-config/medical-professional.json +42 -0
- package/examples-config/multilingual-global.json +33 -0
- package/package.json +17 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EACL,YAAY,EAEZ,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,MAAM,gBAAgB,GAAG,YAAY,CAAC;AACtC,MAAM,cAAc,GAAG,OAAO,CAAC;AA6B/B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OAAO,CAAC,EAAE,mCAAI,IAAI;oBACtB,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,qBAAqB,OAAO,CAAC,MAAM,EAAE,EAAE;iBACxE,CAAC;SACL;IACH,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runStdioServer(): void;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stdio transport for the AllProfanity MCP server.
|
|
3
|
+
*
|
|
4
|
+
* Reads newline-delimited JSON-RPC 2.0 messages from stdin and writes
|
|
5
|
+
* responses to stdout, per the MCP stdio transport specification.
|
|
6
|
+
*
|
|
7
|
+
* Configuration via environment variables:
|
|
8
|
+
* - ALLPROFANITY_LANGUAGES: comma-separated extra languages to load
|
|
9
|
+
* (e.g. "french,german,spanish")
|
|
10
|
+
* - ALLPROFANITY_CONFIG: path to an allprofanity.config.json to load
|
|
11
|
+
*/
|
|
12
|
+
import { readFileSync } from "fs";
|
|
13
|
+
import { dirname, join } from "path";
|
|
14
|
+
import { fileURLToPath } from "url";
|
|
15
|
+
import { createMcpServer } from "./server.js";
|
|
16
|
+
function loadOptionsFromEnv() {
|
|
17
|
+
let options = {};
|
|
18
|
+
const configPath = process.env.ALLPROFANITY_CONFIG;
|
|
19
|
+
if (configPath) {
|
|
20
|
+
try {
|
|
21
|
+
options = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
process.stderr.write(`[allprofanity-mcp] Failed to read config '${configPath}': ${error}\n`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const languages = process.env.ALLPROFANITY_LANGUAGES;
|
|
28
|
+
if (languages) {
|
|
29
|
+
options.languages = languages
|
|
30
|
+
.split(",")
|
|
31
|
+
.map((language) => language.trim())
|
|
32
|
+
.filter((language) => language.length > 0);
|
|
33
|
+
}
|
|
34
|
+
return options;
|
|
35
|
+
}
|
|
36
|
+
export function runStdioServer() {
|
|
37
|
+
// Docs ship with the package: dist/mcp/stdio.js -> package root is ../../
|
|
38
|
+
const packageRoot = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
39
|
+
const server = createMcpServer(loadOptionsFromEnv(), {
|
|
40
|
+
docsRoot: packageRoot,
|
|
41
|
+
});
|
|
42
|
+
let buffer = "";
|
|
43
|
+
process.stdin.setEncoding("utf-8");
|
|
44
|
+
process.stdin.on("data", (chunk) => {
|
|
45
|
+
buffer += chunk;
|
|
46
|
+
let newlineIndex = buffer.indexOf("\n");
|
|
47
|
+
while (newlineIndex !== -1) {
|
|
48
|
+
const line = buffer.slice(0, newlineIndex).trim();
|
|
49
|
+
buffer = buffer.slice(newlineIndex + 1);
|
|
50
|
+
newlineIndex = buffer.indexOf("\n");
|
|
51
|
+
if (line.length === 0)
|
|
52
|
+
continue;
|
|
53
|
+
let response;
|
|
54
|
+
try {
|
|
55
|
+
const request = JSON.parse(line);
|
|
56
|
+
response = server.handleRequest(request);
|
|
57
|
+
}
|
|
58
|
+
catch (_a) {
|
|
59
|
+
response = {
|
|
60
|
+
jsonrpc: "2.0",
|
|
61
|
+
id: null,
|
|
62
|
+
error: { code: -32700, message: "Parse error" },
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (response) {
|
|
66
|
+
process.stdout.write(JSON.stringify(response) + "\n");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
process.stdin.on("end", () => process.exit(0));
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=stdio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../src/mcp/stdio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,I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plug-and-play configuration files for every type of AllProfanity user. Pick the preset that matches your use case, copy it into your project, and load it — no tuning required.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. Copy a preset into your project as allprofanity.config.json
|
|
9
|
+
cp node_modules/allprofanity/examples-config/chat-app.json ./allprofanity.config.json
|
|
10
|
+
|
|
11
|
+
# 2. (Optional) generate the JSON schema for IDE autocomplete
|
|
12
|
+
npx allprofanity
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { AllProfanity } from 'allprofanity';
|
|
17
|
+
import config from './allprofanity.config.json';
|
|
18
|
+
|
|
19
|
+
const filter = AllProfanity.fromConfig(config);
|
|
20
|
+
filter.check('user message here');
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Every preset works as-is and can be tweaked afterwards — the JSON schema (`config.schema.json`) gives you autocomplete and validation in your editor.
|
|
24
|
+
|
|
25
|
+
## Which preset is for me?
|
|
26
|
+
|
|
27
|
+
| Preset | Who it's for | Algorithm | Evasion protection | Context analysis |
|
|
28
|
+
|---|---|---|---|---|
|
|
29
|
+
| [`chat-app.json`](./chat-app.json) | Chat, gaming, comments | Trie + cache | Full | — |
|
|
30
|
+
| [`content-moderation.json`](./content-moderation.json) | UGC platforms, social media | Hybrid + cache | Full | Balanced (0.5) |
|
|
31
|
+
| [`high-throughput-api.json`](./high-throughput-api.json) | APIs, pipelines, documents | Aho-Corasick + cache | Full | — |
|
|
32
|
+
| [`medical-professional.json`](./medical-professional.json) | Medical, legal, academic | Hybrid + cache | Unicode only | Lenient (0.55) |
|
|
33
|
+
| [`family-friendly-max.json`](./family-friendly-max.json) | Kids' platforms, education | Trie + cache | Full + partial words | — |
|
|
34
|
+
| [`low-latency-minimal.json`](./low-latency-minimal.json) | Latency-critical, pre-screened input | Trie only | Off | — |
|
|
35
|
+
| [`multilingual-global.json`](./multilingual-global.json) | Global audiences | Aho-Corasick + cache | Full | — |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Preset details
|
|
40
|
+
|
|
41
|
+
### `chat-app.json` — Real-time chat, gaming, comment sections
|
|
42
|
+
|
|
43
|
+
**Why:** Users in live communities actively try to sneak words past the filter, so every evasion pass is on: leet-speak (`sh1t`), masked characters (`f*ck`), stretched letters (`fuuuuck`), spaced-out spelling (`f u c k`) and Unicode tricks. The default Trie matcher plus the early-exit `check()` keeps short-message latency in the microsecond range, and the result cache absorbs repeated messages (emotes, spam, copypasta).
|
|
44
|
+
|
|
45
|
+
**Trade-off:** None worth noting — this is the recommended starting point for most apps.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### `content-moderation.json` — UGC platforms, social media, forums
|
|
50
|
+
|
|
51
|
+
**Why:** Moderation queues care about false positives as much as misses. This preset layers context analysis (threshold 0.5) on top of full evasion protection, so quoted speech, negations ("not bad") and medical phrasing score lower before flagging. The hybrid engine (Aho-Corasick + Bloom Filter) keeps long posts fast, and a large cache absorbs re-checks when content is edited and resubmitted.
|
|
52
|
+
|
|
53
|
+
**Trade-off:** Context analysis adds a small per-match cost; throughput is still far ahead of comparable libraries.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### `high-throughput-api.json` — Moderation APIs, ingestion pipelines, documents
|
|
58
|
+
|
|
59
|
+
**Why:** When you process large texts or high request volumes, the Aho-Corasick automaton (prebuilt at startup so the first request pays no compile cost) gives single-pass scanning regardless of dictionary size. A 10k-entry cache turns repeated payloads into O(1) lookups. Full evasion protection stays on — its passes only trigger when suspicious characters appear, so clean documents pay near-zero extra.
|
|
60
|
+
|
|
61
|
+
**Trade-off:** Slightly higher startup time (~6 ms) to prebuild the automaton.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### `medical-professional.json` — Medical, legal, academic content
|
|
66
|
+
|
|
67
|
+
**Why:** Professional text legitimately contains anatomical terms and quoted material. This preset raises the context-analysis threshold to 0.55 with a wide 100-character window, enables `strictMode` (matches must sit on clean word boundaries), and turns off the aggressive evasion passes (stretched/masked/separated letters) that professional authors don't use — keeping only Unicode folding for safety.
|
|
68
|
+
|
|
69
|
+
**Trade-off:** Deliberately lenient; an adversarial user could slip evasions past it. Use it for trusted-author content, not open UGC.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### `family-friendly-max.json` — Kids' platforms, education, zero-tolerance spaces
|
|
74
|
+
|
|
75
|
+
**Why:** Maximum recall. `detectPartialWords` flags profanity embedded inside other words ("absofuckinglutely"), and every evasion pass is on. Because partial matching reintroduces the classic false-positive traps ("class" contains "ass"), this preset ships with a whitelist of the common innocents pre-loaded — extend it with the vocabulary of your audience.
|
|
76
|
+
|
|
77
|
+
**Trade-off:** Highest false-positive risk of the pack. Review the whitelist before production and prefer `chat-app.json` if your audience writes long-form text.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### `low-latency-minimal.json` — Latency-critical paths, pre-screened input
|
|
82
|
+
|
|
83
|
+
**Why:** The bare matcher and nothing else: no leet-speak, no evasion passes, no cache. Use when input is already normalized upstream (e.g. a search index, telemetry, machine-generated text) or when every microsecond counts and you accept literal-match-only detection.
|
|
84
|
+
|
|
85
|
+
**Trade-off:** Catches only exact dictionary words. Trivially evadable — never use for live user content.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
### `multilingual-global.json` — Global audiences, international platforms
|
|
90
|
+
|
|
91
|
+
**Why:** Loads all nine built-in language packs (English, Hindi, French, German, Spanish, Bengali, Tamil, Telugu, Brazilian Portuguese) covering Latin, Devanagari, Bengali, Tamil and Telugu scripts, plus Hinglish romanizations. The prebuilt Aho-Corasick automaton keeps scanning single-pass even with the combined dictionary, and full evasion protection covers Unicode tricks across scripts.
|
|
92
|
+
|
|
93
|
+
**Trade-off:** Larger dictionary means slightly more memory (~a few MB) and startup time; per-check speed is unaffected thanks to the automaton.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Mixing and matching
|
|
98
|
+
|
|
99
|
+
Presets are just JSON — combine sections freely. Common tweaks:
|
|
100
|
+
|
|
101
|
+
```jsonc
|
|
102
|
+
// Add your own brand-specific blocklist
|
|
103
|
+
"customDictionaries": { "brand": ["competitorname", "internalcodename"] }
|
|
104
|
+
|
|
105
|
+
// Whitelist domain vocabulary
|
|
106
|
+
"whitelistWords": ["analysis", "assessment"]
|
|
107
|
+
|
|
108
|
+
// Change the censor character
|
|
109
|
+
"profanityDetection": { "defaultPlaceholder": "#" }
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
See the [main README](../README.md) for the full option reference and the
|
|
113
|
+
[configuration schema](../config.schema.json) for validation and autocomplete.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./config.schema.json",
|
|
3
|
+
"algorithm": {
|
|
4
|
+
"matching": "trie"
|
|
5
|
+
},
|
|
6
|
+
"profanityDetection": {
|
|
7
|
+
"enableLeetSpeak": true,
|
|
8
|
+
"caseSensitive": false,
|
|
9
|
+
"strictMode": false,
|
|
10
|
+
"detectPartialWords": false,
|
|
11
|
+
"defaultPlaceholder": "*"
|
|
12
|
+
},
|
|
13
|
+
"evasionProtection": {
|
|
14
|
+
"unicode": true,
|
|
15
|
+
"repeatedCharacters": true,
|
|
16
|
+
"maskedCharacters": true,
|
|
17
|
+
"separatedLetters": true
|
|
18
|
+
},
|
|
19
|
+
"performance": {
|
|
20
|
+
"enableCaching": true,
|
|
21
|
+
"cacheSize": 2000
|
|
22
|
+
},
|
|
23
|
+
"silent": true
|
|
24
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./config.schema.json",
|
|
3
|
+
"algorithm": {
|
|
4
|
+
"matching": "hybrid",
|
|
5
|
+
"useAhoCorasick": true,
|
|
6
|
+
"useBloomFilter": true,
|
|
7
|
+
"useContextAnalysis": true
|
|
8
|
+
},
|
|
9
|
+
"ahoCorasick": {
|
|
10
|
+
"enabled": true,
|
|
11
|
+
"prebuild": true
|
|
12
|
+
},
|
|
13
|
+
"bloomFilter": {
|
|
14
|
+
"enabled": true,
|
|
15
|
+
"expectedItems": 10000,
|
|
16
|
+
"falsePositiveRate": 0.01
|
|
17
|
+
},
|
|
18
|
+
"contextAnalysis": {
|
|
19
|
+
"enabled": true,
|
|
20
|
+
"contextWindow": 50,
|
|
21
|
+
"languages": ["en"],
|
|
22
|
+
"scoreThreshold": 0.5
|
|
23
|
+
},
|
|
24
|
+
"profanityDetection": {
|
|
25
|
+
"enableLeetSpeak": true,
|
|
26
|
+
"caseSensitive": false,
|
|
27
|
+
"strictMode": false,
|
|
28
|
+
"detectPartialWords": false,
|
|
29
|
+
"defaultPlaceholder": "*"
|
|
30
|
+
},
|
|
31
|
+
"evasionProtection": {
|
|
32
|
+
"unicode": true,
|
|
33
|
+
"repeatedCharacters": true,
|
|
34
|
+
"maskedCharacters": true,
|
|
35
|
+
"separatedLetters": true
|
|
36
|
+
},
|
|
37
|
+
"performance": {
|
|
38
|
+
"enableCaching": true,
|
|
39
|
+
"cacheSize": 5000
|
|
40
|
+
},
|
|
41
|
+
"silent": true
|
|
42
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./config.schema.json",
|
|
3
|
+
"algorithm": {
|
|
4
|
+
"matching": "trie"
|
|
5
|
+
},
|
|
6
|
+
"profanityDetection": {
|
|
7
|
+
"enableLeetSpeak": true,
|
|
8
|
+
"caseSensitive": false,
|
|
9
|
+
"strictMode": false,
|
|
10
|
+
"detectPartialWords": true,
|
|
11
|
+
"defaultPlaceholder": "*"
|
|
12
|
+
},
|
|
13
|
+
"evasionProtection": {
|
|
14
|
+
"unicode": true,
|
|
15
|
+
"repeatedCharacters": true,
|
|
16
|
+
"maskedCharacters": true,
|
|
17
|
+
"separatedLetters": true
|
|
18
|
+
},
|
|
19
|
+
"whitelistWords": [
|
|
20
|
+
"class", "classic", "classes", "assassin", "assistant", "assignment",
|
|
21
|
+
"bass", "grass", "glass", "pass", "passed", "compass", "massachusetts",
|
|
22
|
+
"scunthorpe", "shitake", "shiitake", "analysis", "analyst", "canal",
|
|
23
|
+
"cocktail", "hancock", "dickens", "dickinson", "cumulative", "document",
|
|
24
|
+
"butterfly", "saturday", "therapist", "hello",
|
|
25
|
+
"guitar", "guest", "guide", "guess", "gum", "gun", "august", "argument",
|
|
26
|
+
"lull", "lullaby", "skull", "guard", "language", "linguist", "penguin"
|
|
27
|
+
],
|
|
28
|
+
"performance": {
|
|
29
|
+
"enableCaching": true,
|
|
30
|
+
"cacheSize": 2000
|
|
31
|
+
},
|
|
32
|
+
"silent": true
|
|
33
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./config.schema.json",
|
|
3
|
+
"algorithm": {
|
|
4
|
+
"matching": "aho-corasick",
|
|
5
|
+
"useAhoCorasick": true
|
|
6
|
+
},
|
|
7
|
+
"ahoCorasick": {
|
|
8
|
+
"enabled": true,
|
|
9
|
+
"prebuild": true
|
|
10
|
+
},
|
|
11
|
+
"profanityDetection": {
|
|
12
|
+
"enableLeetSpeak": true,
|
|
13
|
+
"caseSensitive": false,
|
|
14
|
+
"strictMode": false,
|
|
15
|
+
"detectPartialWords": false,
|
|
16
|
+
"defaultPlaceholder": "*"
|
|
17
|
+
},
|
|
18
|
+
"evasionProtection": {
|
|
19
|
+
"unicode": true,
|
|
20
|
+
"repeatedCharacters": true,
|
|
21
|
+
"maskedCharacters": true,
|
|
22
|
+
"separatedLetters": true
|
|
23
|
+
},
|
|
24
|
+
"performance": {
|
|
25
|
+
"enableCaching": true,
|
|
26
|
+
"cacheSize": 10000
|
|
27
|
+
},
|
|
28
|
+
"silent": true
|
|
29
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./config.schema.json",
|
|
3
|
+
"algorithm": {
|
|
4
|
+
"matching": "trie"
|
|
5
|
+
},
|
|
6
|
+
"profanityDetection": {
|
|
7
|
+
"enableLeetSpeak": false,
|
|
8
|
+
"caseSensitive": false,
|
|
9
|
+
"strictMode": false,
|
|
10
|
+
"detectPartialWords": false,
|
|
11
|
+
"defaultPlaceholder": "*"
|
|
12
|
+
},
|
|
13
|
+
"evasionProtection": {
|
|
14
|
+
"unicode": false,
|
|
15
|
+
"repeatedCharacters": false,
|
|
16
|
+
"maskedCharacters": false,
|
|
17
|
+
"separatedLetters": false
|
|
18
|
+
},
|
|
19
|
+
"performance": {
|
|
20
|
+
"enableCaching": false,
|
|
21
|
+
"cacheSize": 0
|
|
22
|
+
},
|
|
23
|
+
"silent": true
|
|
24
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./config.schema.json",
|
|
3
|
+
"algorithm": {
|
|
4
|
+
"matching": "hybrid",
|
|
5
|
+
"useAhoCorasick": true,
|
|
6
|
+
"useBloomFilter": true,
|
|
7
|
+
"useContextAnalysis": true
|
|
8
|
+
},
|
|
9
|
+
"ahoCorasick": {
|
|
10
|
+
"enabled": true,
|
|
11
|
+
"prebuild": true
|
|
12
|
+
},
|
|
13
|
+
"bloomFilter": {
|
|
14
|
+
"enabled": true,
|
|
15
|
+
"expectedItems": 10000,
|
|
16
|
+
"falsePositiveRate": 0.01
|
|
17
|
+
},
|
|
18
|
+
"contextAnalysis": {
|
|
19
|
+
"enabled": true,
|
|
20
|
+
"contextWindow": 100,
|
|
21
|
+
"languages": ["en"],
|
|
22
|
+
"scoreThreshold": 0.55
|
|
23
|
+
},
|
|
24
|
+
"profanityDetection": {
|
|
25
|
+
"enableLeetSpeak": true,
|
|
26
|
+
"caseSensitive": false,
|
|
27
|
+
"strictMode": true,
|
|
28
|
+
"detectPartialWords": false,
|
|
29
|
+
"defaultPlaceholder": "*"
|
|
30
|
+
},
|
|
31
|
+
"evasionProtection": {
|
|
32
|
+
"unicode": true,
|
|
33
|
+
"repeatedCharacters": false,
|
|
34
|
+
"maskedCharacters": false,
|
|
35
|
+
"separatedLetters": false
|
|
36
|
+
},
|
|
37
|
+
"performance": {
|
|
38
|
+
"enableCaching": true,
|
|
39
|
+
"cacheSize": 2000
|
|
40
|
+
},
|
|
41
|
+
"silent": true
|
|
42
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./config.schema.json",
|
|
3
|
+
"algorithm": {
|
|
4
|
+
"matching": "aho-corasick",
|
|
5
|
+
"useAhoCorasick": true
|
|
6
|
+
},
|
|
7
|
+
"ahoCorasick": {
|
|
8
|
+
"enabled": true,
|
|
9
|
+
"prebuild": true
|
|
10
|
+
},
|
|
11
|
+
"languages": [
|
|
12
|
+
"english", "hindi", "french", "german", "spanish",
|
|
13
|
+
"bengali", "tamil", "telugu", "brazilian"
|
|
14
|
+
],
|
|
15
|
+
"profanityDetection": {
|
|
16
|
+
"enableLeetSpeak": true,
|
|
17
|
+
"caseSensitive": false,
|
|
18
|
+
"strictMode": false,
|
|
19
|
+
"detectPartialWords": false,
|
|
20
|
+
"defaultPlaceholder": "*"
|
|
21
|
+
},
|
|
22
|
+
"evasionProtection": {
|
|
23
|
+
"unicode": true,
|
|
24
|
+
"repeatedCharacters": true,
|
|
25
|
+
"maskedCharacters": true,
|
|
26
|
+
"separatedLetters": true
|
|
27
|
+
},
|
|
28
|
+
"performance": {
|
|
29
|
+
"enableCaching": true,
|
|
30
|
+
"cacheSize": 5000
|
|
31
|
+
},
|
|
32
|
+
"silent": true
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "allprofanity",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.3.0",
|
|
4
|
+
"description": "Evasion-resistant, multi-language profanity filter: leet-speak, masked words (f*ck), stretched letters, spaced-out spelling, and Unicode homoglyph detection with zero false positives on the classic traps. 9 languages, sub-millisecond checks, advanced algorithms (Aho-Corasick, Bloom Filters), zero dependencies.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
"test": "jest",
|
|
12
12
|
"test:watch": "jest --watch",
|
|
13
13
|
"test:coverage": "jest --coverage",
|
|
14
|
-
"benchmark": "
|
|
15
|
-
"benchmark:
|
|
14
|
+
"benchmark": "tsc -p tsconfig.benchmark.json && node --expose-gc dist-bench/benchmark/profanity-benchmark.js",
|
|
15
|
+
"benchmark:algorithms": "tsc -p tsconfig.benchmark.json && node dist-bench/benchmark/compare-algorithms.js",
|
|
16
|
+
"benchmark:algo-toggle": "tsc -p tsconfig.benchmark.json && node dist-bench/benchmark/algo-on-off-comparison.js",
|
|
17
|
+
"benchmark:context": "tsc -p tsconfig.benchmark.json && node dist-bench/benchmark/context-awareness-tests.js",
|
|
18
|
+
"benchmark:compare": "node benchmark/compare-libraries.mjs",
|
|
16
19
|
"clean": "rimraf dist coverage",
|
|
17
20
|
"prepare": "npm run clean && npm run build",
|
|
18
21
|
"prepublishOnly": "npm test",
|
|
@@ -34,7 +37,12 @@
|
|
|
34
37
|
"typescript",
|
|
35
38
|
"performance",
|
|
36
39
|
"fast",
|
|
37
|
-
"leet-speak"
|
|
40
|
+
"leet-speak",
|
|
41
|
+
"evasion-detection",
|
|
42
|
+
"homoglyph",
|
|
43
|
+
"unicode",
|
|
44
|
+
"text-moderation",
|
|
45
|
+
"chat-filter"
|
|
38
46
|
],
|
|
39
47
|
"author": {
|
|
40
48
|
"name": "Ayush Jadaun",
|
|
@@ -44,7 +52,7 @@
|
|
|
44
52
|
"license": "MIT",
|
|
45
53
|
"repository": {
|
|
46
54
|
"type": "git",
|
|
47
|
-
"url": "https://github.com/ayush-jadaun/AllProfanity.git"
|
|
55
|
+
"url": "git+https://github.com/ayush-jadaun/AllProfanity.git"
|
|
48
56
|
},
|
|
49
57
|
"homepage": "https://github.com/ayush-jadaun/AllProfanity#readme",
|
|
50
58
|
"devDependencies": {
|
|
@@ -58,6 +66,7 @@
|
|
|
58
66
|
"files": [
|
|
59
67
|
"dist",
|
|
60
68
|
"bin",
|
|
69
|
+
"examples-config",
|
|
61
70
|
"LICENSE",
|
|
62
71
|
"README.md",
|
|
63
72
|
"allprofanity.config.example.json",
|
|
@@ -65,6 +74,7 @@
|
|
|
65
74
|
"CONTRIBUTORS.md"
|
|
66
75
|
],
|
|
67
76
|
"bin": {
|
|
68
|
-
"allprofanity": "
|
|
77
|
+
"allprofanity": "bin/init.js",
|
|
78
|
+
"allprofanity-mcp": "bin/mcp.js"
|
|
69
79
|
}
|
|
70
80
|
}
|