allprofanity 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2025 Ayush Jadaun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
package/README.md ADDED
@@ -0,0 +1,297 @@
1
+ # AllProfanity
2
+
3
+ A comprehensive multi-language profanity filter for JavaScript/TypeScript applications with built-in support for English, Hindi, and Hinglish content.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/allprofanity.svg)](https://www.npmjs.com/package/allprofanity)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## Features
9
+
10
+ - **Multi-language Support**: Pre-loaded with English profanities (from leo-profanity) and an extensive Hindi/Hinglish dictionary
11
+ - **Multiple Scripts**: Detects profanity in both Latin/Roman and Devanagari scripts
12
+ - **Case Insensitive**: Works regardless of letter case
13
+ - **Flexible Cleaning Options**:
14
+ - Character-level replacement (each character of a profane word becomes a placeholder)
15
+ - Word-level replacement (entire profane word becomes a single placeholder)
16
+ - **Customizable**:
17
+ - Dynamically add/remove words from the filter
18
+ - Set custom placeholder characters or strings
19
+ - **Zero Dependencies**: Only depends on leo-profanity as the base filter
20
+ - **TypeScript Support**: Full TypeScript type definitions included
21
+ - **Extensible**: Designed with multi-language support in mind, making it easy to add more languages in the future
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ npm install allprofanity
27
+ # or
28
+ yarn add allprofanity
29
+ # or
30
+ pnpm add allprofanity
31
+ ```
32
+
33
+ ## Basic Usage
34
+
35
+ ```javascript
36
+ import profanity from 'allprofanity';
37
+
38
+ // Check if a string contains profanity
39
+ profanity.check('This is a clean sentence.'); // false
40
+ profanity.check('This is a fucking test.'); // true
41
+ profanity.check('यह एक चूतिया परीक्षण है।'); // true (Hindi example)
42
+ profanity.check('Ye ek chutiya test hai.'); // true (Hinglish example)
43
+
44
+ // Clean profanity (character by character replacement)
45
+ profanity.clean('This is a fucking test.');
46
+ // => "This is a ****ing test."
47
+
48
+ // Clean profanity (whole word replacement)
49
+ profanity.cleanWithWord('This is a fucking test.');
50
+ // => "This is a *** test."
51
+ ```
52
+
53
+ ## API Reference
54
+
55
+ ### `check(string: string): boolean`
56
+
57
+ Checks if a string contains any profanity from the loaded dictionaries.
58
+
59
+ ```javascript
60
+ profanity.check('This contains bullshit.'); // true
61
+ profanity.check('This is clean.'); // false
62
+ ```
63
+
64
+ ### `clean(string: string, placeholder?: string): string`
65
+
66
+ Cleans a string by replacing each character of profane words with a placeholder character.
67
+
68
+ ```javascript
69
+ // Default placeholder is "*"
70
+ profanity.clean('This contains bullshit.');
71
+ // => "This contains ********."
72
+
73
+ // Custom placeholder character
74
+ profanity.clean('This contains bullshit.', '#');
75
+ // => "This contains ########."
76
+ ```
77
+
78
+ ### `cleanWithWord(string: string, placeholder?: string): string`
79
+
80
+ Cleans a string by replacing entire profane words with a single placeholder string.
81
+
82
+ ```javascript
83
+ // Default placeholder is "***"
84
+ profanity.cleanWithWord('This contains bullshit.');
85
+ // => "This contains ***."
86
+
87
+ // Custom placeholder string
88
+ profanity.cleanWithWord('This contains bullshit.', '[CENSORED]');
89
+ // => "This contains [CENSORED]."
90
+ ```
91
+
92
+ ### `list(): string[]`
93
+
94
+ Returns an array of all the profanity words currently in the filter.
95
+
96
+ ```javascript
97
+ const words = profanity.list();
98
+ console.log(words); // ["fuck", "bullshit", "chutiya", ...]
99
+ ```
100
+
101
+ ### `add(word: string | string[]): void`
102
+
103
+ Adds one or more words to the profanity filter.
104
+
105
+ ```javascript
106
+ // Add a single word
107
+ profanity.add('badword');
108
+
109
+ // Add multiple words
110
+ profanity.add(['badword1', 'badword2', 'बुराशब्द']);
111
+ ```
112
+
113
+ ### `remove(word: string | string[]): void`
114
+
115
+ Removes one or more words from the profanity filter.
116
+
117
+ ```javascript
118
+ // Remove a single word
119
+ profanity.remove('bullshit');
120
+
121
+ // Remove multiple words
122
+ profanity.remove(['fuck', 'chutiya']);
123
+ ```
124
+
125
+ ### `clearList(): void`
126
+
127
+ Removes all words from the profanity filter, resetting it to an empty list.
128
+
129
+ ```javascript
130
+ profanity.clearList();
131
+ ```
132
+
133
+ ### `setPlaceholder(placeholder: string): void`
134
+
135
+ Sets the default placeholder character for the `clean` method.
136
+
137
+ ```javascript
138
+ // Set "#" as the default placeholder character
139
+ profanity.setPlaceholder('#');
140
+ ```
141
+
142
+ ## Word Boundary Detection
143
+
144
+ The library is designed to handle word boundaries correctly, reducing false positives:
145
+
146
+ ```javascript
147
+ profanity.check('He is an associate professor.'); // false, even though 'ass' is a profane word
148
+ profanity.check('I'm an analyst at this company.'); // false, even though 'anal' is a profane word
149
+ profanity.check('This is ass and that's bad.'); // true
150
+ ```
151
+
152
+ ## Language Support
153
+
154
+ ### Current Languages
155
+
156
+ #### English
157
+
158
+ Built on top of the leo-profanity library, AllProfanity includes comprehensive English profanity detection.
159
+
160
+ #### Hindi/Hinglish Support
161
+
162
+ The library comes pre-loaded with an extensive list of Hindi profanities in both Devanagari and Roman scripts, as well as common Hinglish abbreviations and variations.
163
+
164
+ ```javascript
165
+ // Hindi in Devanagari script
166
+ profanity.check('इस वाक्य में लंड शब्द है।'); // true
167
+
168
+ // Hindi in Roman script
169
+ profanity.check('Is vakya mein lund shabd hai.'); // true
170
+
171
+ // Hinglish abbreviations
172
+ profanity.check('Usne bc kaha.'); // true
173
+ ```
174
+
175
+ ### Future Language Support
176
+
177
+ AllProfanity is designed with extensibility in mind. Future versions will include support for additional languages. If you'd like to contribute language packs, please see the Contributing section below.
178
+
179
+ ## Mixed Language Content
180
+
181
+ AllProfanity effectively handles mixed-language content containing profanities from different languages:
182
+
183
+ ```javascript
184
+ profanity.check('This English sentence has chutiya which is bad.'); // true
185
+ profanity.check('I'm saying मादरचोद and bullshit in one sentence.'); // true
186
+ ```
187
+
188
+ ## Customizing The Library
189
+
190
+ ### Adding Custom Profanity Lists
191
+
192
+ You can add your own profanity lists to extend support for other languages:
193
+
194
+ ```javascript
195
+ // Add Spanish profanity words
196
+ profanity.add([
197
+ 'mierda',
198
+ 'puta',
199
+ 'pendejo',
200
+ 'carajo',
201
+ 'coño'
202
+ ]);
203
+
204
+ // Now it will detect Spanish profanity
205
+ profanity.check('Este es un ejemplo de mierda.'); // true
206
+ ```
207
+
208
+ ### Creating a Custom-Configured Instance
209
+
210
+ If you need multiple differently-configured instances of the filter, you can import the AllProfanity class directly:
211
+
212
+ ```javascript
213
+ import { AllProfanity } from 'allprofanity';
214
+
215
+ // Create custom instances
216
+ const kidSafeFilter = new AllProfanity({ includeModerate: true });
217
+ const adultFilter = new AllProfanity({ includeModerate: false });
218
+ ```
219
+
220
+ ## Advanced Use Cases
221
+
222
+ ### Performance Optimization
223
+
224
+ For applications processing large volumes of text:
225
+
226
+ ```javascript
227
+ // Pre-compile your most used strings for faster checking
228
+ const badWordsList = profanity.list();
229
+ const preCompiledRegex = new RegExp('\\b(' + badWordsList.join('|') + ')\\b', 'i');
230
+
231
+ function quickCheck(text) {
232
+ return preCompiledRegex.test(text);
233
+ }
234
+ ```
235
+
236
+ ### Content Moderation Systems
237
+
238
+ ```javascript
239
+ function moderateContent(content) {
240
+ if (profanity.check(content)) {
241
+ return {
242
+ isApproved: false,
243
+ cleanedContent: profanity.cleanWithWord(content, '[INAPPROPRIATE]'),
244
+ reason: 'Contains profanity'
245
+ };
246
+ }
247
+ return { isApproved: true, cleanedContent: content };
248
+ }
249
+ ```
250
+
251
+ ## Use Cases
252
+
253
+ - Content moderation systems
254
+ - Chat applications
255
+ - User-generated content platforms
256
+ - Educational software
257
+ - Forums and community platforms
258
+ - Social media content filtering
259
+ - Comment sections
260
+ - Gaming chat filters
261
+ - Email filtering
262
+ - Document processing systems
263
+
264
+ ## Browser Support
265
+
266
+ AllProfanity works in all modern browsers and Node.js environments.
267
+
268
+ ## Roadmap
269
+
270
+ - Add support for more languages (Spanish, French, German, Arabic, etc.)
271
+ - Contextual profanity detection
272
+ - Severity levels for different categories of profanity
273
+ - Phonetic matching for evasion attempts
274
+ - Plugin system for custom detection strategies
275
+
276
+ ## License
277
+
278
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/yourusername/allprofanity/blob/main/LICENSE) file for details.
279
+
280
+ ## Contributing
281
+
282
+ Contributions are welcome! Whether it's adding new language support, improving detection algorithms, or enhancing documentation.
283
+
284
+ Please feel free to submit a Pull Request or open an Issue on GitHub.
285
+
286
+ ### Adding a New Language
287
+
288
+ To add support for a new language:
289
+
290
+ 1. Create a new file in the `src/languages` directory (e.g., `french-words.ts`)
291
+ 2. Follow the format of the existing word lists
292
+ 3. Submit a pull request with your changes
293
+
294
+ ## Acknowledgements
295
+
296
+ - Built on top of [leo-profanity](https://github.com/jojoee/leo-profanity)
297
+ - Thanks to all contributors who have helped expand the language suppor
@@ -0,0 +1,92 @@
1
+ export { default as hindiBadWords } from "./languages/hindi-words";
2
+ /**
3
+ * Configuration options for AllProfanity
4
+ */
5
+ export interface AllProfanityOptions {
6
+ languages?: string[];
7
+ customDictionaries?: Record<string, string[]>;
8
+ defaultPlaceholder?: string;
9
+ }
10
+ /**
11
+ * AllProfanity - Extended profanity filter with multi-language support
12
+ * Based on leo-profanity with additional language capabilities
13
+ */
14
+ export declare class AllProfanity {
15
+ private filter;
16
+ private defaultPlaceholder;
17
+ private loadedLanguages;
18
+ private availableLanguages;
19
+ /**
20
+ * Create a new AllProfanity instance
21
+ * @param options - Configuration options
22
+ */
23
+ constructor(options?: AllProfanityOptions);
24
+ /**
25
+ * Load a built-in language dictionary
26
+ * @param language - The language to load
27
+ * @returns boolean - True if loaded successfully, false otherwise
28
+ */
29
+ loadLanguage(language: string): boolean;
30
+ /**
31
+ * Load a custom dictionary with a given name
32
+ * @param name - Name to identify this dictionary
33
+ * @param words - Array of profanity words
34
+ */
35
+ loadCustomDictionary(name: string, words: string[]): void;
36
+ /**
37
+ * Get the list of currently loaded languages
38
+ * @returns string[] - Array of loaded language names
39
+ */
40
+ getLoadedLanguages(): string[];
41
+ /**
42
+ * Get the list of available language dictionaries
43
+ * @returns string[] - Array of available language names
44
+ */
45
+ getAvailableLanguages(): string[];
46
+ /**
47
+ * Check if a string contains profanity
48
+ * @param string - The string to check
49
+ * @returns boolean - True if profanity found, false otherwise
50
+ */
51
+ check(string: string): boolean;
52
+ /**
53
+ * Clean a string by replacing profanities with placeholders
54
+ * @param string - The string to clean
55
+ * @param placeholder - Optional custom placeholder (defaults to '*')
56
+ * @returns string - The cleaned string
57
+ */
58
+ clean(string: string, placeholder?: string): string;
59
+ /**
60
+ * Clean a string by replacing each profane word with a single placeholder
61
+ * @param string - The string to clean
62
+ * @param placeholder - The placeholder to use (defaults to '***')
63
+ * @returns string - The cleaned string
64
+ */
65
+ cleanWithWord(string: string, placeholder?: string): string;
66
+ /**
67
+ * Get the current list of profanity words
68
+ * @returns string[] - Array of all profanity words
69
+ */
70
+ list(): string[];
71
+ /**
72
+ * Add word(s) to the profanity list
73
+ * @param word - String or array of strings to add
74
+ */
75
+ add(word: string | string[]): void;
76
+ /**
77
+ * Remove word(s) from the profanity list
78
+ * @param word - String or array of strings to remove
79
+ */
80
+ remove(word: string | string[]): void;
81
+ /**
82
+ * Clear the filter list and reset to default
83
+ */
84
+ clearList(): void;
85
+ /**
86
+ * Change the character used as placeholder
87
+ * @param placeholder - Single character to use as placeholder
88
+ */
89
+ setPlaceholder(placeholder: string): void;
90
+ }
91
+ declare const allProfanity: AllProfanity;
92
+ export default allProfanity;
package/dist/index.js ADDED
@@ -0,0 +1,222 @@
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
+ exports.AllProfanity = exports.hindiBadWords = void 0;
7
+ // src/index.ts
8
+ const leo_profanity_1 = __importDefault(require("leo-profanity"));
9
+ const hindi_words_1 = __importDefault(require("./languages/hindi-words"));
10
+ // Export language dictionaries for direct access
11
+ var hindi_words_2 = require("./languages/hindi-words");
12
+ Object.defineProperty(exports, "hindiBadWords", { enumerable: true, get: function () { return __importDefault(hindi_words_2).default; } });
13
+ /**
14
+ * AllProfanity - Extended profanity filter with multi-language support
15
+ * Based on leo-profanity with additional language capabilities
16
+ */
17
+ class AllProfanity {
18
+ /**
19
+ * Create a new AllProfanity instance
20
+ * @param options - Configuration options
21
+ */
22
+ constructor(options) {
23
+ this.defaultPlaceholder = "*";
24
+ this.loadedLanguages = new Set();
25
+ this.availableLanguages = {
26
+ hindi: hindi_words_1.default,
27
+ // Add more built-in languages here in the future
28
+ };
29
+ this.filter = leo_profanity_1.default;
30
+ // Set custom placeholder if provided
31
+ if (options === null || options === void 0 ? void 0 : options.defaultPlaceholder) {
32
+ this.setPlaceholder(options.defaultPlaceholder);
33
+ }
34
+ // Load the default English dictionary from leo-profanity
35
+ this.loadedLanguages.add("english");
36
+ // Load Hindi by default for backward compatibility
37
+ this.loadLanguage("hindi");
38
+ // Load any additional languages specified in options
39
+ if (options === null || options === void 0 ? void 0 : options.languages) {
40
+ options.languages.forEach((lang) => this.loadLanguage(lang));
41
+ }
42
+ // Load any custom dictionaries
43
+ if (options === null || options === void 0 ? void 0 : options.customDictionaries) {
44
+ Object.entries(options.customDictionaries).forEach(([langName, words]) => {
45
+ this.loadCustomDictionary(langName, words);
46
+ });
47
+ }
48
+ }
49
+ /**
50
+ * Load a built-in language dictionary
51
+ * @param language - The language to load
52
+ * @returns boolean - True if loaded successfully, false otherwise
53
+ */
54
+ loadLanguage(language) {
55
+ // Skip if already loaded
56
+ if (this.loadedLanguages.has(language.toLowerCase())) {
57
+ return true;
58
+ }
59
+ const langKey = language.toLowerCase();
60
+ if (this.availableLanguages[langKey]) {
61
+ this.filter.add(this.availableLanguages[langKey]);
62
+ this.loadedLanguages.add(langKey);
63
+ console.log(`AllProfanity: Added ${this.availableLanguages[langKey].length} ${language} words to the profanity list.`);
64
+ return true;
65
+ }
66
+ else {
67
+ console.warn(`AllProfanity: Language '${language}' not found in available dictionaries.`);
68
+ return false;
69
+ }
70
+ }
71
+ /**
72
+ * Load a custom dictionary with a given name
73
+ * @param name - Name to identify this dictionary
74
+ * @param words - Array of profanity words
75
+ */
76
+ loadCustomDictionary(name, words) {
77
+ if (!words || words.length === 0) {
78
+ console.warn(`AllProfanity: Custom dictionary '${name}' has no words.`);
79
+ return;
80
+ }
81
+ // Add to available languages for future reference
82
+ this.availableLanguages[name.toLowerCase()] = words;
83
+ // Add to filter
84
+ this.filter.add(words);
85
+ this.loadedLanguages.add(name.toLowerCase());
86
+ console.log(`AllProfanity: Added ${words.length} words from custom '${name}' dictionary.`);
87
+ }
88
+ /**
89
+ * Get the list of currently loaded languages
90
+ * @returns string[] - Array of loaded language names
91
+ */
92
+ getLoadedLanguages() {
93
+ return Array.from(this.loadedLanguages);
94
+ }
95
+ /**
96
+ * Get the list of available language dictionaries
97
+ * @returns string[] - Array of available language names
98
+ */
99
+ getAvailableLanguages() {
100
+ return Object.keys(this.availableLanguages);
101
+ }
102
+ /**
103
+ * Check if a string contains profanity
104
+ * @param string - The string to check
105
+ * @returns boolean - True if profanity found, false otherwise
106
+ */
107
+ check(string) {
108
+ return this.filter.check(string);
109
+ }
110
+ /**
111
+ * Clean a string by replacing profanities with placeholders
112
+ * @param string - The string to clean
113
+ * @param placeholder - Optional custom placeholder (defaults to '*')
114
+ * @returns string - The cleaned string
115
+ */
116
+ clean(string, placeholder) {
117
+ // More general solution for handling variations like "fucking"
118
+ const badWords = this.list();
119
+ let result = string;
120
+ for (const word of badWords) {
121
+ // Check for variations with "ing", "ed", etc.
122
+ const variations = [
123
+ `${word}ing`,
124
+ `${word}ed`,
125
+ `${word}s`,
126
+ `${word}er`,
127
+ `${word}ers`,
128
+ ];
129
+ for (const variation of variations) {
130
+ if (result.toLowerCase().includes(variation.toLowerCase())) {
131
+ const prefix = word;
132
+ const suffix = variation.slice(word.length);
133
+ const replacement = (placeholder || this.defaultPlaceholder).repeat(prefix.length) +
134
+ suffix;
135
+ // Use regex to replace while preserving case (though this simplifies it)
136
+ const regex = new RegExp(variation, "gi");
137
+ result = result.replace(regex, replacement);
138
+ }
139
+ }
140
+ }
141
+ // Fall back to default leo-profanity implementation
142
+ return this.filter.clean(result, placeholder || this.defaultPlaceholder);
143
+ }
144
+ /**
145
+ * Clean a string by replacing each profane word with a single placeholder
146
+ * @param string - The string to clean
147
+ * @param placeholder - The placeholder to use (defaults to '***')
148
+ * @returns string - The cleaned string
149
+ */
150
+ cleanWithWord(string, placeholder = "***") {
151
+ // Split by spaces but preserve punctuation
152
+ const regex = /([^\w\s])/g;
153
+ let tempString = string.replace(regex, " $1 ");
154
+ const words = tempString.split(" ").filter((w) => w !== "");
155
+ const result = words.map((word) => {
156
+ // Check if this word contains profanity, ignoring punctuation for the check
157
+ const wordWithoutPunctuation = word.replace(/[^\w\s]/g, "");
158
+ if (wordWithoutPunctuation && this.check(wordWithoutPunctuation)) {
159
+ return placeholder;
160
+ }
161
+ return word;
162
+ });
163
+ // Join and fix spaces before punctuation
164
+ let cleaned = result.join(" ");
165
+ cleaned = cleaned.replace(/ ([^\w\s]) /g, "$1 "); // Fix space before punctuation
166
+ cleaned = cleaned.replace(/ ([^\w\s])$/g, "$1"); // Fix trailing punctuation
167
+ return cleaned;
168
+ }
169
+ /**
170
+ * Get the current list of profanity words
171
+ * @returns string[] - Array of all profanity words
172
+ */
173
+ list() {
174
+ return this.filter.list();
175
+ }
176
+ /**
177
+ * Add word(s) to the profanity list
178
+ * @param word - String or array of strings to add
179
+ */
180
+ add(word) {
181
+ this.filter.add(word);
182
+ }
183
+ /**
184
+ * Remove word(s) from the profanity list
185
+ * @param word - String or array of strings to remove
186
+ */
187
+ remove(word) {
188
+ this.filter.remove(word);
189
+ }
190
+ /**
191
+ * Clear the filter list and reset to default
192
+ */
193
+ clearList() {
194
+ // Get all current words
195
+ const currentWords = this.filter.list();
196
+ // Remove all words
197
+ if (currentWords.length > 0) {
198
+ this.filter.remove(currentWords);
199
+ }
200
+ // Reset loaded languages tracking
201
+ this.loadedLanguages.clear();
202
+ this.loadedLanguages.add("english"); // Default language remains
203
+ }
204
+ /**
205
+ * Change the character used as placeholder
206
+ * @param placeholder - Single character to use as placeholder
207
+ */
208
+ setPlaceholder(placeholder) {
209
+ if (placeholder.length !== 1) {
210
+ console.warn("AllProfanity: Placeholder should be a single character. Using first character.");
211
+ this.defaultPlaceholder = placeholder.charAt(0);
212
+ }
213
+ else {
214
+ this.defaultPlaceholder = placeholder;
215
+ }
216
+ }
217
+ }
218
+ exports.AllProfanity = AllProfanity;
219
+ // Create and export a singleton instance with default settings
220
+ const allProfanity = new AllProfanity();
221
+ exports.default = allProfanity;
222
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,eAAe;AACf,kEAAyC;A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;IACH,MAAM,CAAC,IAAuB;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,SAAS;QACP,wBAAwB;QACxB,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACxC,mBAAmB;QACnB,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;SAClC;QACD,kCAAkC;QAClC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,2BAA2B;IAClE,CAAC;IAED;;;OAGG;IACH,cAAc,CAAC,WAAmB;QAChC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,OAAO,CAAC,IAAI,CACV,gFAAgF,CACjF,CAAC;YACF,IAAI,CAAC,kBAAkB,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACjD;aAAM;YACL,IAAI,CAAC,kBAAkB,GAAG,WAAW,CAAC;SACvC;IACH,CAAC;CACF;AA/OD,oCA+OC;AAED,+DAA+D;AAC/D,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;AACxC,kBAAe,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Hindi/Hinglish profanity words list
3
+ * Contains common profanities in both Devanagari and Roman scripts
4
+ * ⚠️ Warning: This file contains explicit language in Hindi
5
+ */
6
+ declare const hindiBadWords: string[];
7
+ export default hindiBadWords;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ // src/hindi-words.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ /**
5
+ * Hindi/Hinglish profanity words list
6
+ * Contains common profanities in both Devanagari and Roman scripts
7
+ * ⚠️ Warning: This file contains explicit language in Hindi
8
+ */
9
+ const hindiBadWords = [
10
+ // Roman script Hindi/Hinglish profanities
11
+ "behen chod",
12
+ "behenchod",
13
+ "bc",
14
+ "bhenchod",
15
+ "bakchod",
16
+ "chutiya",
17
+ "chutiyapa",
18
+ "gandu",
19
+ "gaandu",
20
+ "harami",
21
+ "haramzada",
22
+ "kutta",
23
+ "kutte",
24
+ "kamina",
25
+ "lund",
26
+ "lauda",
27
+ "loda",
28
+ "randi",
29
+ "saala",
30
+ "madarchod",
31
+ "mc",
32
+ "chod",
33
+ "chodu",
34
+ // Devanagari script profanities
35
+ "भड़वा",
36
+ "भोसड़ी",
37
+ "बहन चोद",
38
+ "भेन चोद",
39
+ "चूतिया",
40
+ "हरामी",
41
+ "हरामज़ादा",
42
+ "कमीना",
43
+ "लंड",
44
+ "लौड़ा",
45
+ "रंडी",
46
+ "साला",
47
+ "मादरचोद",
48
+ // Common misspellings and variations
49
+ "bhnchd",
50
+ "behanchod",
51
+ "bhanchod",
52
+ "bhen chod",
53
+ "chutia",
54
+ "rendi",
55
+ "maderchod",
56
+ "madarchood",
57
+ "madarjaat",
58
+ "gandoo",
59
+ // Add more words as needed...
60
+ ];
61
+ exports.default = hindiBadWords;
62
+ //# sourceMappingURL=hindi-words.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hindi-words.js","sourceRoot":"","sources":["../../src/languages/hindi-words.ts"],"names":[],"mappings":";AAAA,qBAAqB;;AAErB;;;;GAIG;AACH,MAAM,aAAa,GAAa;IAC9B,0CAA0C;IAC1C,YAAY;IACZ,WAAW;IACX,IAAI;IACJ,UAAU;IACV,SAAS;IACT,SAAS;IACT,WAAW;IACX,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,OAAO;IACP,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,WAAW;IACX,IAAI;IACJ,MAAM;IACN,OAAO;IAEP,gCAAgC;IAChC,OAAO;IACP,QAAQ;IACR,SAAS;IACT,SAAS;IACT,QAAQ;IACR,OAAO;IACP,WAAW;IACX,OAAO;IACP,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,SAAS;IAET,qCAAqC;IACrC,QAAQ;IACR,WAAW;IACX,UAAU;IACV,WAAW;IACX,QAAQ;IACR,OAAO;IACP,WAAW;IACX,YAAY;IACZ,WAAW;IACX,QAAQ;IAER,8BAA8B;CAC/B,CAAC;AAEF,kBAAe,aAAa,CAAC"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "allprofanity",
3
+ "version": "1.0.0",
4
+ "description": "A TypeScript package to filter Hindi and Hinglish bad words from text",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "type": "module",
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "test": "jest",
12
+ "test:watch": "jest --watch",
13
+ "test:coverage": "jest --coverage",
14
+ "clean": "rimraf dist coverage",
15
+ "prepare": "npm run clean && npm run build",
16
+ "prepublishOnly": "npm test",
17
+ "preversion": "npm run test",
18
+ "version": "git add -A src"
19
+ },
20
+ "keywords": [
21
+ "hindi",
22
+ "hinglish",
23
+ "profanity",
24
+ "filter",
25
+ "bad-words",
26
+ "censorship",
27
+ "content-moderation",
28
+ "typescript"
29
+ ],
30
+ "author": {
31
+ "name": "Ayush Jadaun",
32
+ "email": "ayushjadaun6@gmail.com",
33
+ "url": "https://github.com/ayush-jadaun"
34
+ },
35
+ "license": "MIT",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/ayush-jadaun/AllProfanity.git"
39
+ },
40
+ "homepage": "https://github.com/ayush-jadaun/AllProfanity#readme",
41
+ "devDependencies": {
42
+ "@types/jest": "^29.5.0",
43
+ "jest": "^29.5.0",
44
+ "rimraf": "^5.0.0",
45
+ "ts-jest": "^29.1.0",
46
+ "ts-node": "^10.0.0",
47
+ "typescript": "^4.0.0"
48
+ },
49
+ "files": [
50
+ "dist",
51
+ "LICENSE",
52
+ "README.md"
53
+ ],
54
+ "dependencies": {
55
+ "leo-profanity": "^1.7.0"
56
+ }
57
+ }