glin-profanity 2.0.0 → 2.3.3

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.
Files changed (124) hide show
  1. package/README.md +338 -74
  2. package/lib/cjs/packages/js/src/core/index.d.ts +4 -0
  3. package/lib/cjs/packages/js/src/core/index.js +55 -0
  4. package/lib/cjs/packages/js/src/core/index.js.map +1 -0
  5. package/lib/cjs/packages/js/src/core/types.d.ts +20 -0
  6. package/lib/cjs/packages/js/src/core/types.js +3 -0
  7. package/lib/cjs/packages/js/src/core/types.js.map +1 -0
  8. package/lib/cjs/{data → packages/js/src/data}/dictionary.d.ts +1 -0
  9. package/lib/cjs/packages/js/src/data/dictionary.js +54 -0
  10. package/lib/cjs/packages/js/src/data/dictionary.js.map +1 -0
  11. package/lib/cjs/{filters → packages/js/src/filters}/Filter.d.ts +13 -14
  12. package/lib/cjs/packages/js/src/filters/Filter.js +246 -0
  13. package/lib/cjs/packages/js/src/filters/Filter.js.map +1 -0
  14. package/lib/cjs/packages/js/src/hooks/useProfanityChecker.d.ts +11 -0
  15. package/lib/cjs/packages/js/src/hooks/useProfanityChecker.js +42 -0
  16. package/lib/cjs/packages/js/src/hooks/useProfanityChecker.js.map +1 -0
  17. package/lib/cjs/packages/js/src/index.d.ts +12 -0
  18. package/lib/cjs/packages/js/src/index.js +24 -0
  19. package/lib/cjs/packages/js/src/index.js.map +1 -0
  20. package/lib/cjs/packages/js/src/nlp/contextAnalyzer.d.ts +35 -0
  21. package/lib/cjs/packages/js/src/nlp/contextAnalyzer.js +203 -0
  22. package/lib/cjs/packages/js/src/nlp/contextAnalyzer.js.map +1 -0
  23. package/lib/cjs/packages/js/src/types/types.d.ts +56 -0
  24. package/lib/cjs/packages/js/src/types/types.js +14 -0
  25. package/lib/cjs/packages/js/src/types/types.js.map +1 -0
  26. package/lib/cjs/shared/dictionaries/spanish.json +72 -0
  27. package/lib/esm/packages/js/src/core/index.d.ts +4 -0
  28. package/lib/esm/packages/js/src/core/index.js +47 -0
  29. package/lib/esm/packages/js/src/core/index.js.map +1 -0
  30. package/lib/esm/packages/js/src/core/types.d.ts +20 -0
  31. package/lib/esm/packages/js/src/core/types.js +2 -0
  32. package/lib/esm/packages/js/src/core/types.js.map +1 -0
  33. package/lib/esm/{data → packages/js/src/data}/dictionary.d.ts +1 -0
  34. package/lib/esm/packages/js/src/data/dictionary.js +49 -0
  35. package/lib/esm/packages/js/src/data/dictionary.js.map +1 -0
  36. package/lib/esm/{filters → packages/js/src/filters}/Filter.d.ts +13 -14
  37. package/lib/esm/packages/js/src/filters/Filter.js +240 -0
  38. package/lib/esm/packages/js/src/filters/Filter.js.map +1 -0
  39. package/lib/esm/packages/js/src/hooks/useProfanityChecker.d.ts +11 -0
  40. package/lib/esm/packages/js/src/hooks/useProfanityChecker.js +38 -0
  41. package/lib/esm/packages/js/src/hooks/useProfanityChecker.js.map +1 -0
  42. package/lib/esm/packages/js/src/index.d.ts +12 -0
  43. package/lib/esm/packages/js/src/index.js +15 -0
  44. package/lib/esm/packages/js/src/index.js.map +1 -0
  45. package/lib/esm/packages/js/src/nlp/contextAnalyzer.d.ts +35 -0
  46. package/lib/esm/packages/js/src/nlp/contextAnalyzer.js +199 -0
  47. package/lib/esm/packages/js/src/nlp/contextAnalyzer.js.map +1 -0
  48. package/lib/esm/packages/js/src/types/types.d.ts +56 -0
  49. package/lib/esm/packages/js/src/types/types.js +11 -0
  50. package/lib/esm/packages/js/src/types/types.js.map +1 -0
  51. package/lib/esm/shared/dictionaries/spanish.json +72 -0
  52. package/package.json +26 -3
  53. package/lib/cjs/data/dictionary.js +0 -52
  54. package/lib/cjs/data/dictionary.js.map +0 -1
  55. package/lib/cjs/filters/Filter.js +0 -137
  56. package/lib/cjs/filters/Filter.js.map +0 -1
  57. package/lib/cjs/hooks/useProfanityChecker.d.ts +0 -20
  58. package/lib/cjs/hooks/useProfanityChecker.js +0 -58
  59. package/lib/cjs/hooks/useProfanityChecker.js.map +0 -1
  60. package/lib/cjs/index.d.ts +0 -3
  61. package/lib/cjs/index.js +0 -8
  62. package/lib/cjs/index.js.map +0 -1
  63. package/lib/cjs/types/types.d.ts +0 -14
  64. package/lib/cjs/types/types.js +0 -11
  65. package/lib/cjs/types/types.js.map +0 -1
  66. package/lib/esm/data/dictionary.js +0 -47
  67. package/lib/esm/data/dictionary.js.map +0 -1
  68. package/lib/esm/filters/Filter.js +0 -131
  69. package/lib/esm/filters/Filter.js.map +0 -1
  70. package/lib/esm/hooks/useProfanityChecker.d.ts +0 -20
  71. package/lib/esm/hooks/useProfanityChecker.js +0 -51
  72. package/lib/esm/hooks/useProfanityChecker.js.map +0 -1
  73. package/lib/esm/index.d.ts +0 -3
  74. package/lib/esm/index.js +0 -3
  75. package/lib/esm/index.js.map +0 -1
  76. package/lib/esm/types/types.d.ts +0 -14
  77. package/lib/esm/types/types.js +0 -8
  78. package/lib/esm/types/types.js.map +0 -1
  79. /package/lib/cjs/{data → shared/dictionaries}/Norwegian.json +0 -0
  80. /package/lib/cjs/{data → shared/dictionaries}/arabic.json +0 -0
  81. /package/lib/cjs/{data → shared/dictionaries}/chinese.json +0 -0
  82. /package/lib/cjs/{data → shared/dictionaries}/czech.json +0 -0
  83. /package/lib/cjs/{data → shared/dictionaries}/danish.json +0 -0
  84. /package/lib/cjs/{data → shared/dictionaries}/english.json +0 -0
  85. /package/lib/cjs/{data → shared/dictionaries}/esperanto.json +0 -0
  86. /package/lib/cjs/{data → shared/dictionaries}/finnish.json +0 -0
  87. /package/lib/cjs/{data → shared/dictionaries}/french.json +0 -0
  88. /package/lib/cjs/{data → shared/dictionaries}/german.json +0 -0
  89. /package/lib/cjs/{data → shared/dictionaries}/globalWhitelist.json +0 -0
  90. /package/lib/cjs/{data → shared/dictionaries}/hindi.json +0 -0
  91. /package/lib/cjs/{data → shared/dictionaries}/hungarian.json +0 -0
  92. /package/lib/cjs/{data → shared/dictionaries}/italian.json +0 -0
  93. /package/lib/cjs/{data → shared/dictionaries}/japanese.json +0 -0
  94. /package/lib/cjs/{data → shared/dictionaries}/korean.json +0 -0
  95. /package/lib/cjs/{data → shared/dictionaries}/persian.json +0 -0
  96. /package/lib/cjs/{data → shared/dictionaries}/polish.json +0 -0
  97. /package/lib/cjs/{data → shared/dictionaries}/portuguese.json +0 -0
  98. /package/lib/cjs/{data → shared/dictionaries}/russian.json +0 -0
  99. /package/lib/cjs/{data → shared/dictionaries}/swedish.json +0 -0
  100. /package/lib/cjs/{data → shared/dictionaries}/thai.json +0 -0
  101. /package/lib/cjs/{data → shared/dictionaries}/turkish.json +0 -0
  102. /package/lib/esm/{data → shared/dictionaries}/Norwegian.json +0 -0
  103. /package/lib/esm/{data → shared/dictionaries}/arabic.json +0 -0
  104. /package/lib/esm/{data → shared/dictionaries}/chinese.json +0 -0
  105. /package/lib/esm/{data → shared/dictionaries}/czech.json +0 -0
  106. /package/lib/esm/{data → shared/dictionaries}/danish.json +0 -0
  107. /package/lib/esm/{data → shared/dictionaries}/english.json +0 -0
  108. /package/lib/esm/{data → shared/dictionaries}/esperanto.json +0 -0
  109. /package/lib/esm/{data → shared/dictionaries}/finnish.json +0 -0
  110. /package/lib/esm/{data → shared/dictionaries}/french.json +0 -0
  111. /package/lib/esm/{data → shared/dictionaries}/german.json +0 -0
  112. /package/lib/esm/{data → shared/dictionaries}/globalWhitelist.json +0 -0
  113. /package/lib/esm/{data → shared/dictionaries}/hindi.json +0 -0
  114. /package/lib/esm/{data → shared/dictionaries}/hungarian.json +0 -0
  115. /package/lib/esm/{data → shared/dictionaries}/italian.json +0 -0
  116. /package/lib/esm/{data → shared/dictionaries}/japanese.json +0 -0
  117. /package/lib/esm/{data → shared/dictionaries}/korean.json +0 -0
  118. /package/lib/esm/{data → shared/dictionaries}/persian.json +0 -0
  119. /package/lib/esm/{data → shared/dictionaries}/polish.json +0 -0
  120. /package/lib/esm/{data → shared/dictionaries}/portuguese.json +0 -0
  121. /package/lib/esm/{data → shared/dictionaries}/russian.json +0 -0
  122. /package/lib/esm/{data → shared/dictionaries}/swedish.json +0 -0
  123. /package/lib/esm/{data → shared/dictionaries}/thai.json +0 -0
  124. /package/lib/esm/{data → shared/dictionaries}/turkish.json +0 -0
@@ -0,0 +1,38 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { useState, useCallback } from 'react';
11
+ import { checkProfanity, checkProfanityAsync, isWordProfane } from '../core';
12
+ export const useProfanityChecker = (config) => {
13
+ var _a;
14
+ const [result, setResult] = useState(null);
15
+ const checkText = useCallback((text) => {
16
+ const checkResult = checkProfanity(text, config);
17
+ setResult(checkResult);
18
+ return checkResult;
19
+ }, [config]);
20
+ const checkTextAsync = useCallback((text) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const checkResult = yield checkProfanityAsync(text, config);
22
+ setResult(checkResult);
23
+ return checkResult;
24
+ }), [config]);
25
+ const isWordProfaneCallback = useCallback((word) => {
26
+ return isWordProfane(word, config);
27
+ }, [config]);
28
+ const reset = useCallback(() => setResult(null), []);
29
+ return {
30
+ result,
31
+ checkText,
32
+ checkTextAsync,
33
+ reset,
34
+ isDirty: (_a = result === null || result === void 0 ? void 0 : result.containsProfanity) !== null && _a !== void 0 ? _a : false,
35
+ isWordProfane: isWordProfaneCallback,
36
+ };
37
+ };
38
+ //# sourceMappingURL=useProfanityChecker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProfanityChecker.js","sourceRoot":"","sources":["../../../../../../src/hooks/useProfanityChecker.ts"],"names":[],"mappings":";;;;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CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Glin-Profanity: Lightweight and efficient profanity detection and filtering.
3
+ *
4
+ * Provides multi-language support, context-aware filtering, and customizable
5
+ * configurations for detecting and filtering profane language in text inputs.
6
+ */
7
+ export { checkProfanity, checkProfanityAsync, isWordProfane } from './core';
8
+ export type { ProfanityCheckerConfig, ProfanityCheckResult } from './core/types';
9
+ export { useProfanityChecker } from './hooks/useProfanityChecker';
10
+ export { Filter } from './filters/Filter';
11
+ export { SeverityLevel } from './types/types';
12
+ export type { Language, CheckProfanityResult, FilterConfig, FilteredProfanityResult, Match, ContextAwareConfig } from './types/types';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Glin-Profanity: Lightweight and efficient profanity detection and filtering.
3
+ *
4
+ * Provides multi-language support, context-aware filtering, and customizable
5
+ * configurations for detecting and filtering profane language in text inputs.
6
+ */
7
+ // Core API (framework-agnostic)
8
+ export { checkProfanity, checkProfanityAsync, isWordProfane } from './core';
9
+ // React-specific
10
+ export { useProfanityChecker } from './hooks/useProfanityChecker';
11
+ // Advanced/Low-level
12
+ export { Filter } from './filters/Filter';
13
+ // Legacy types (maintain compatibility)
14
+ export { SeverityLevel } from './types/types';
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,gCAAgC;AAChC,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,aAAa,EACd,MAAM,QAAQ,CAAC;AAOhB,iBAAiB;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,qBAAqB;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,wCAAwC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { Language } from '../types/types';
2
+ export interface ContextAnalysisResult {
3
+ contextScore: number;
4
+ reason: string;
5
+ isWhitelisted: boolean;
6
+ }
7
+ export interface ContextConfig {
8
+ contextWindow: number;
9
+ language: Language;
10
+ domainWhitelists?: string[];
11
+ }
12
+ export declare class ContextAnalyzer {
13
+ private contextWindow;
14
+ private language;
15
+ private domainWhitelists;
16
+ constructor(config: ContextConfig);
17
+ /**
18
+ * Analyzes the context around a profanity match to determine if it should be flagged
19
+ */
20
+ analyzeContext(text: string, matchWord: string, matchIndex: number): ContextAnalysisResult;
21
+ private tokenize;
22
+ private findWordIndex;
23
+ private checkPhraseContext;
24
+ private isDomainWhitelisted;
25
+ private calculateSentimentScore;
26
+ private generateReason;
27
+ /**
28
+ * Updates the domain whitelist for this analyzer instance
29
+ */
30
+ updateDomainWhitelist(newWhitelist: string[]): void;
31
+ /**
32
+ * Adds words to the domain whitelist
33
+ */
34
+ addToDomainWhitelist(words: string[]): void;
35
+ }
@@ -0,0 +1,199 @@
1
+ // Positive sentiment indicators
2
+ const POSITIVE_INDICATORS = new Set([
3
+ 'amazing', 'awesome', 'excellent', 'fantastic', 'great', 'love', 'wonderful',
4
+ 'brilliant', 'perfect', 'incredible', 'outstanding', 'superb', 'magnificent',
5
+ 'marvelous', 'spectacular', 'phenomenal', 'terrific', 'fabulous', 'divine',
6
+ 'best', 'good', 'nice', 'cool', 'sweet', 'rad', 'sick', 'dope', 'fire',
7
+ 'lit', 'epic', 'legendary', 'godlike', 'insane', 'crazy', 'wild', 'beast',
8
+ 'movie', 'film', 'show', 'song', 'music', 'game', 'book', 'restaurant',
9
+ 'food', 'dish', 'meal', 'place', 'spot', 'location', 'experience'
10
+ ]);
11
+ // Negative sentiment indicators
12
+ const NEGATIVE_INDICATORS = new Set([
13
+ 'hate', 'terrible', 'awful', 'horrible', 'disgusting', 'pathetic', 'stupid',
14
+ 'idiot', 'moron', 'loser', 'worthless', 'useless', 'garbage', 'trash',
15
+ 'suck', 'sucks', 'worst', 'bad', 'ugly', 'gross', 'nasty', 'annoying',
16
+ 'irritating', 'frustrating', 'disappointing', 'lame', 'weak', 'fail',
17
+ 'you', 'your', 'yourself', 'u', 'ur', 'ure', 'youre'
18
+ ]);
19
+ // Domain-specific positive contexts
20
+ const GAMING_POSITIVE = new Set([
21
+ 'player', 'gamer', 'team', 'squad', 'clan', 'guild', 'match', 'game',
22
+ 'round', 'level', 'boss', 'raid', 'quest', 'achievement', 'skill',
23
+ 'build', 'loadout', 'strategy', 'tactic', 'play', 'move', 'combo'
24
+ ]);
25
+ // Common positive phrases that might contain flagged words
26
+ const POSITIVE_PHRASES = new Map([
27
+ ['the bomb', 0.9], // "this movie is the bomb"
28
+ ['da bomb', 0.9], // slang for "the best"
29
+ ['bomb.com', 0.9], // website reference
30
+ ['bomb diggity', 0.9], // slang for excellent
31
+ ['photo bomb', 0.8], // photography term
32
+ ['bath bomb', 0.8], // cosmetic product
33
+ ['bomb squad', 0.7], // could be neutral/positive in gaming
34
+ ]);
35
+ // Negative phrases that should remain flagged
36
+ const NEGATIVE_PHRASES = new Map([
37
+ ['you are', 0.1], // "you are [profanity]"
38
+ ['ur a', 0.1], // "ur a [profanity]"
39
+ ['such a', 0.2], // "such a [profanity]"
40
+ ['fucking', 0.1], // intensifier, usually negative
41
+ ['damn', 0.2], // mild profanity, context dependent
42
+ ]);
43
+ export class ContextAnalyzer {
44
+ constructor(config) {
45
+ this.contextWindow = config.contextWindow;
46
+ this.language = config.language;
47
+ this.domainWhitelists = new Set(config.domainWhitelists || []);
48
+ }
49
+ /**
50
+ * Analyzes the context around a profanity match to determine if it should be flagged
51
+ */
52
+ analyzeContext(text, matchWord, matchIndex) {
53
+ const words = this.tokenize(text);
54
+ const matchWordIndex = this.findWordIndex(words, matchIndex);
55
+ if (matchWordIndex === -1) {
56
+ return {
57
+ contextScore: 0.5,
58
+ reason: 'Could not locate match in tokenized text',
59
+ isWhitelisted: false
60
+ };
61
+ }
62
+ // Extract context window
63
+ const startIndex = Math.max(0, matchWordIndex - this.contextWindow);
64
+ const endIndex = Math.min(words.length, matchWordIndex + this.contextWindow + 1);
65
+ const contextWords = words.slice(startIndex, endIndex);
66
+ const contextText = contextWords.join(' ').toLowerCase();
67
+ // Check for exact phrase matches first
68
+ const phraseResult = this.checkPhraseContext(contextText, matchWord);
69
+ if (phraseResult) {
70
+ return phraseResult;
71
+ }
72
+ // Check domain-specific whitelists
73
+ if (this.isDomainWhitelisted(contextWords, matchWord)) {
74
+ return {
75
+ contextScore: 0.8,
76
+ reason: 'Domain-specific whitelist match',
77
+ isWhitelisted: true
78
+ };
79
+ }
80
+ // Perform sentiment analysis
81
+ const sentimentScore = this.calculateSentimentScore(contextWords, matchWordIndex - startIndex);
82
+ return {
83
+ contextScore: sentimentScore,
84
+ reason: this.generateReason(sentimentScore, contextWords),
85
+ isWhitelisted: false
86
+ };
87
+ }
88
+ tokenize(text) {
89
+ // Simple tokenization - split on whitespace and punctuation
90
+ return text.toLowerCase()
91
+ .replace(/[^\w\s]/g, ' ')
92
+ .split(/\s+/)
93
+ .filter(word => word.length > 0);
94
+ }
95
+ findWordIndex(words, charIndex) {
96
+ // This is a simplified approach - in production, you'd want more robust mapping
97
+ // For now, we'll estimate based on the character position
98
+ let currentPos = 0;
99
+ for (let i = 0; i < words.length; i++) {
100
+ if (currentPos >= charIndex) {
101
+ return Math.max(0, i - 1);
102
+ }
103
+ currentPos += words[i].length + 1; // +1 for space
104
+ }
105
+ return words.length - 1;
106
+ }
107
+ checkPhraseContext(contextText, matchWord) {
108
+ // Check positive phrases
109
+ for (const [phrase, score] of POSITIVE_PHRASES.entries()) {
110
+ if (contextText.includes(phrase)) {
111
+ return {
112
+ contextScore: score,
113
+ reason: `Positive phrase detected: "${phrase}"`,
114
+ isWhitelisted: true
115
+ };
116
+ }
117
+ }
118
+ // Check negative phrases
119
+ for (const [phrase, score] of NEGATIVE_PHRASES.entries()) {
120
+ if (contextText.includes(phrase)) {
121
+ return {
122
+ contextScore: score,
123
+ reason: `Negative phrase detected: "${phrase}"`,
124
+ isWhitelisted: false
125
+ };
126
+ }
127
+ }
128
+ return null;
129
+ }
130
+ isDomainWhitelisted(contextWords, matchWord) {
131
+ // Check if any domain whitelist words are present
132
+ for (const word of contextWords) {
133
+ if (this.domainWhitelists.has(word) || GAMING_POSITIVE.has(word)) {
134
+ return true;
135
+ }
136
+ }
137
+ return false;
138
+ }
139
+ calculateSentimentScore(contextWords, matchPosition) {
140
+ let positiveCount = 0;
141
+ let negativeCount = 0;
142
+ let totalWords = contextWords.length;
143
+ // Weight words closer to the match more heavily
144
+ for (let i = 0; i < contextWords.length; i++) {
145
+ const word = contextWords[i];
146
+ const distance = Math.abs(i - matchPosition);
147
+ const weight = Math.max(0.1, 1 - (distance * 0.2)); // Closer words have higher weight
148
+ if (POSITIVE_INDICATORS.has(word)) {
149
+ positiveCount += weight;
150
+ }
151
+ else if (NEGATIVE_INDICATORS.has(word)) {
152
+ negativeCount += weight;
153
+ }
154
+ }
155
+ // Calculate base score
156
+ const totalSentiment = positiveCount + negativeCount;
157
+ if (totalSentiment === 0) {
158
+ return 0.5; // Neutral if no sentiment indicators
159
+ }
160
+ const rawScore = positiveCount / totalSentiment;
161
+ // Apply context-specific adjustments
162
+ let adjustedScore = rawScore;
163
+ // If there are personal pronouns (you, your), lean towards negative
164
+ const hasPersonalPronouns = contextWords.some(word => ['you', 'your', 'u', 'ur'].includes(word));
165
+ if (hasPersonalPronouns && rawScore < 0.7) {
166
+ adjustedScore *= 0.7; // Reduce score when personal pronouns are present
167
+ }
168
+ // If there are object/thing references, lean towards positive
169
+ const hasObjectReferences = contextWords.some(word => ['movie', 'song', 'game', 'book', 'show', 'this', 'that', 'it'].includes(word));
170
+ if (hasObjectReferences && rawScore > 0.3) {
171
+ adjustedScore = Math.min(1, adjustedScore * 1.3); // Boost score for object references
172
+ }
173
+ return Math.max(0, Math.min(1, adjustedScore));
174
+ }
175
+ generateReason(score, contextWords) {
176
+ if (score >= 0.7) {
177
+ return 'Positive context detected - likely not profanity';
178
+ }
179
+ else if (score <= 0.3) {
180
+ return 'Negative context detected - likely profanity';
181
+ }
182
+ else {
183
+ return 'Neutral context - uncertain classification';
184
+ }
185
+ }
186
+ /**
187
+ * Updates the domain whitelist for this analyzer instance
188
+ */
189
+ updateDomainWhitelist(newWhitelist) {
190
+ this.domainWhitelists = new Set(newWhitelist);
191
+ }
192
+ /**
193
+ * Adds words to the domain whitelist
194
+ */
195
+ addToDomainWhitelist(words) {
196
+ words.forEach(word => this.domainWhitelists.add(word.toLowerCase()));
197
+ }
198
+ }
199
+ //# sourceMappingURL=contextAnalyzer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextAnalyzer.js","sourceRoot":"","sources":["../../../../../../src/nlp/contextAnalyzer.ts"],"names":[],"mappings":"AAeA,gCAAgC;AAChC,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW;IAC5E,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa;IAC5E,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ;IAC1E,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IACtE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO;IACzE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY;IACtE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY;CAClE,CAAC,CAAC;AAEH,gCAAgC;AAChC,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,MAAM,EAAE,UAAU,E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Type definitions for glin-profanity JavaScript/TypeScript package.
3
+ * Unified API that mirrors the Python package structure.
4
+ */
5
+ /** Severity levels for profanity matches - unified with Python */
6
+ export declare enum SeverityLevel {
7
+ EXACT = 1,
8
+ FUZZY = 2
9
+ }
10
+ /** Supported languages - unified list with Python */
11
+ export type Language = 'arabic' | 'chinese' | 'czech' | 'danish' | 'english' | 'esperanto' | 'finnish' | 'french' | 'german' | 'hindi' | 'hungarian' | 'italian' | 'japanese' | 'korean' | 'norwegian' | 'persian' | 'polish' | 'portuguese' | 'russian' | 'spanish' | 'swedish' | 'thai' | 'turkish';
12
+ /** Represents a profanity match in text - unified with Python */
13
+ export interface Match {
14
+ word: string;
15
+ index: number;
16
+ severity: SeverityLevel;
17
+ contextScore?: number;
18
+ reason?: string;
19
+ isWhitelisted?: boolean;
20
+ }
21
+ /** Result of profanity check operation - unified field names */
22
+ export interface CheckProfanityResult {
23
+ containsProfanity: boolean;
24
+ profaneWords: string[];
25
+ processedText?: string;
26
+ severityMap?: Record<string, SeverityLevel>;
27
+ matches?: Match[];
28
+ contextScore?: number;
29
+ reason?: string;
30
+ }
31
+ /** Configuration for context-aware filtering - unified with Python */
32
+ export interface ContextAwareConfig {
33
+ enableContextAware?: boolean;
34
+ contextWindow?: number;
35
+ confidenceThreshold?: number;
36
+ domainWhitelists?: Record<string, string[]>;
37
+ }
38
+ /** Main filter configuration options - unified with Python */
39
+ export interface FilterConfig extends ContextAwareConfig {
40
+ languages?: Language[];
41
+ allLanguages?: boolean;
42
+ caseSensitive?: boolean;
43
+ wordBoundaries?: boolean;
44
+ customWords?: string[];
45
+ replaceWith?: string;
46
+ severityLevels?: boolean;
47
+ ignoreWords?: string[];
48
+ logProfanity?: boolean;
49
+ allowObfuscatedMatch?: boolean;
50
+ fuzzyToleranceLevel?: number;
51
+ }
52
+ /** Result with minimum severity filtering */
53
+ export interface FilteredProfanityResult {
54
+ result: CheckProfanityResult;
55
+ filteredWords: string[];
56
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Type definitions for glin-profanity JavaScript/TypeScript package.
3
+ * Unified API that mirrors the Python package structure.
4
+ */
5
+ /** Severity levels for profanity matches - unified with Python */
6
+ export var SeverityLevel;
7
+ (function (SeverityLevel) {
8
+ SeverityLevel[SeverityLevel["EXACT"] = 1] = "EXACT";
9
+ SeverityLevel[SeverityLevel["FUZZY"] = 2] = "FUZZY";
10
+ })(SeverityLevel || (SeverityLevel = {}));
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/types/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,kEAAkE;AAClE,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,mDAAS,CAAA;IACT,mDAAS,CAAA;AACX,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB"}
@@ -0,0 +1,72 @@
1
+ {
2
+ "words": [
3
+ "sesinato",
4
+ "asno",
5
+ "bastardo",
6
+ "Bollera",
7
+ "Cabron",
8
+ "Cabrón",
9
+ "Caca",
10
+ "Chupada",
11
+ "Chupapollas",
12
+ "Chupetón",
13
+ "concha",
14
+ "Concha de tu madre",
15
+ "Coño",
16
+ "Coprofagía",
17
+ "Culo",
18
+ "Drogas",
19
+ "Esperma",
20
+ "Fiesta de salchichas",
21
+ "Follador",
22
+ "Follar",
23
+ "Gilipichis",
24
+ "Gilipollas",
25
+ "Hacer una paja",
26
+ "Haciendo el amor",
27
+ "Heroína",
28
+ "Hija de puta",
29
+ "Hijaputa",
30
+ "Hijo de puta",
31
+ "Hijoputa",
32
+ "Idiota",
33
+ "Imbécil",
34
+ "infierno",
35
+ "Jilipollas",
36
+ "Kapullo",
37
+ "Lameculos",
38
+ "Maciza",
39
+ "Macizorra",
40
+ "maldito",
41
+ "Mamada",
42
+ "Marica",
43
+ "Maricón",
44
+ "Mariconazo",
45
+ "martillo",
46
+ "Mierda",
47
+ "Nazi",
48
+ "Orina",
49
+ "Pedo",
50
+ "Pervertido",
51
+ "Pezón",
52
+ "Pinche",
53
+ "Pis",
54
+ "Prostituta",
55
+ "Puta",
56
+ "Racista",
57
+ "Ramera",
58
+ "Sádico",
59
+ "Semen",
60
+ "Sexo",
61
+ "Sexo oral",
62
+ "Soplagaitas",
63
+ "Soplapollas",
64
+ "Tetas grandes",
65
+ "Tía buena",
66
+ "Travesti",
67
+ "Trio",
68
+ "Verga",
69
+ "vete a la mierda",
70
+ "Vulva"
71
+ ]
72
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glin-profanity",
3
- "version": "2.0.0",
3
+ "version": "2.3.3",
4
4
  "description": "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.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -24,7 +24,12 @@
24
24
  "scripts": {
25
25
  "build:cjs": "tsc -p tsconfig.commonjs.json",
26
26
  "build:esm": "tsc -p tsconfig.esm.json",
27
- "build": "npm run build:cjs && npm run build:esm"
27
+ "build": "npm run build:cjs && npm run build:esm",
28
+ "test": "jest",
29
+ "test:watch": "jest --watch",
30
+ "test:coverage": "jest --coverage",
31
+ "test:ci": "jest --ci --coverage --watchAll=false",
32
+ "semantic-release": "semantic-release"
28
33
  },
29
34
  "repository": {
30
35
  "type": "git",
@@ -72,5 +77,23 @@
72
77
  "profanity-moderation-module"
73
78
  ],
74
79
  "author": "glinr",
75
- "license": "ISC"
80
+ "license": "ISC",
81
+ "devDependencies": {
82
+ "@semantic-release/changelog": "^6.0.3",
83
+ "@semantic-release/git": "^10.0.1",
84
+ "@semantic-release/github": "^11.0.3",
85
+ "@semantic-release/npm": "^12.0.2",
86
+ "@testing-library/jest-dom": "^6.6.4",
87
+ "@testing-library/react": "^16.3.0",
88
+ "@types/jest": "^30.0.0",
89
+ "@types/react": "^18.3.3",
90
+ "@types/react-dom": "^18.3.0",
91
+ "jest": "^30.0.5",
92
+ "jest-environment-jsdom": "^30.0.5",
93
+ "react": "^18.3.1",
94
+ "react-dom": "^18.3.1",
95
+ "semantic-release": "^24.2.7",
96
+ "ts-jest": "^29.4.0",
97
+ "typescript": "^5.8.3"
98
+ }
76
99
  }
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const arabic_json_1 = __importDefault(require("./arabic.json"));
7
- const chinese_json_1 = __importDefault(require("./chinese.json"));
8
- const czech_json_1 = __importDefault(require("./czech.json"));
9
- const danish_json_1 = __importDefault(require("./danish.json"));
10
- const esperanto_json_1 = __importDefault(require("./esperanto.json"));
11
- const english_json_1 = __importDefault(require("./english.json"));
12
- const finnish_json_1 = __importDefault(require("./finnish.json"));
13
- const german_json_1 = __importDefault(require("./german.json"));
14
- const hindi_json_1 = __importDefault(require("./hindi.json"));
15
- const hungarian_json_1 = __importDefault(require("./hungarian.json"));
16
- const korean_json_1 = __importDefault(require("./korean.json"));
17
- const Norwegian_json_1 = __importDefault(require("./Norwegian.json"));
18
- const persian_json_1 = __importDefault(require("./persian.json"));
19
- const polish_json_1 = __importDefault(require("./polish.json"));
20
- const portuguese_json_1 = __importDefault(require("./portuguese.json"));
21
- const russian_json_1 = __importDefault(require("./russian.json"));
22
- const french_json_1 = __importDefault(require("./french.json"));
23
- const italian_json_1 = __importDefault(require("./italian.json"));
24
- const japanese_json_1 = __importDefault(require("./japanese.json"));
25
- const turkish_json_1 = __importDefault(require("./turkish.json"));
26
- const swedish_json_1 = __importDefault(require("./swedish.json"));
27
- const thai_json_1 = __importDefault(require("./thai.json"));
28
- exports.default = {
29
- arabic: arabic_json_1.default.words,
30
- chinese: chinese_json_1.default.words,
31
- czech: czech_json_1.default.words,
32
- danish: danish_json_1.default.words,
33
- english: english_json_1.default.words,
34
- esperanto: esperanto_json_1.default.words,
35
- finnish: finnish_json_1.default.words,
36
- french: french_json_1.default.words,
37
- german: german_json_1.default.words,
38
- hindi: hindi_json_1.default.words,
39
- hungarian: hungarian_json_1.default.words,
40
- italian: italian_json_1.default.words,
41
- japanese: japanese_json_1.default.words,
42
- korean: korean_json_1.default.words,
43
- norwegian: Norwegian_json_1.default.words,
44
- persian: persian_json_1.default.words,
45
- polish: polish_json_1.default.words,
46
- portuguese: portuguese_json_1.default.words,
47
- russian: russian_json_1.default.words,
48
- turkish: turkish_json_1.default.words,
49
- swedish: swedish_json_1.default.words,
50
- thai: thai_json_1.default.words,
51
- };
52
- //# sourceMappingURL=dictionary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../../src/data/dictionary.ts"],"names":[],"mappings":";;;;;AAAA,gEAAmC;AACnC,kEAAqC;AACrC,8DAAiC;AACjC,gEAAmC;AACnC,sEAAyC;AACzC,kEAAqC;AACrC,kEAAqC;AACrC,gEAAmC;AACnC,8DAAiC;AACjC,sEAAyC;AACzC,gEAAmC;AACnC,sEAAyC;AACzC,kEAAqC;AACrC,gEAAmC;AACnC,wEAA2C;AAC3C,kEAAqC;AACrC,gEAAmC;AACnC,kEAAqC;AACrC,oEAAuC;AACvC,kEAAqC;AACrC,kEAAqC;AACrC,4DAA+B;AAC/B,kBAAe;IACb,MAAM,EAAE,qBAAM,CAAC,KAAK;IACpB,OAAO,EAAE,sBAAO,CAAC,KAAK;IACtB,KAAK,EAAE,oBAAK,CAAC,KAAK;IAClB,MAAM,EAAE,qBAAM,CAAC,KAAK;IACpB,OAAO,EAAE,sBAAO,CAAC,KAAK;IACtB,SAAS,EAAE,wBAAS,CAAC,KAAK;IAC1B,OAAO,EAAE,sBAAO,CAAC,KAAK;IACtB,MAAM,EAAE,qBAAM,CAAC,KAAK;IACpB,MAAM,EAAE,qBAAM,CAAC,KAAK;IACpB,KAAK,EAAE,o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