@sharpapi/sharpapi-node-detect-profanities 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/README.md +427 -0
- package/package.json +41 -0
- package/src/SharpApiDetectProfanitiesService.js +22 -0
- package/src/index.js +6 -0
package/README.md
ADDED
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Profanity Detection API for Node.js
|
|
4
|
+
|
|
5
|
+
## 🛡️ Detect profanities and inappropriate content with AI — powered by SharpAPI.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@sharpapi/sharpapi-node-detect-profanities)
|
|
8
|
+
[](https://github.com/sharpapi/sharpapi-node-client/blob/master/LICENSE.md)
|
|
9
|
+
|
|
10
|
+
**SharpAPI Profanity Detection** analyzes text content for profanities, offensive language, and inappropriate content using AI. Essential for content moderation, community guidelines enforcement, and maintaining safe user environments.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📋 Table of Contents
|
|
15
|
+
|
|
16
|
+
1. [Requirements](#requirements)
|
|
17
|
+
2. [Installation](#installation)
|
|
18
|
+
3. [Usage](#usage)
|
|
19
|
+
4. [API Documentation](#api-documentation)
|
|
20
|
+
5. [Response Format](#response-format)
|
|
21
|
+
6. [Examples](#examples)
|
|
22
|
+
7. [License](#license)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Requirements
|
|
27
|
+
|
|
28
|
+
- Node.js >= 16.x
|
|
29
|
+
- npm or yarn
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
### Step 1. Install the package via npm:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @sharpapi/sharpapi-node-detect-profanities
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 2. Get your API key
|
|
42
|
+
|
|
43
|
+
Visit [SharpAPI.com](https://sharpapi.com/) to get your API key.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
const { SharpApiDetectProfanitiesService } = require('@sharpapi/sharpapi-node-detect-profanities');
|
|
51
|
+
|
|
52
|
+
const apiKey = process.env.SHARP_API_KEY;
|
|
53
|
+
const service = new SharpApiDetectProfanitiesService(apiKey);
|
|
54
|
+
|
|
55
|
+
const userComment = `
|
|
56
|
+
This is a sample comment that might contain inappropriate language.
|
|
57
|
+
Checking for profanities and offensive content.
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
async function checkContent() {
|
|
61
|
+
try {
|
|
62
|
+
const statusUrl = await service.detectProfanities(userComment);
|
|
63
|
+
console.log('Job submitted. Status URL:', statusUrl);
|
|
64
|
+
|
|
65
|
+
const result = await service.fetchResults(statusUrl);
|
|
66
|
+
const detection = result.getResultJson();
|
|
67
|
+
|
|
68
|
+
if (!detection.result.pass) {
|
|
69
|
+
console.log('⚠️ Profanity detected!');
|
|
70
|
+
console.log('Confidence:', detection.result.score + '%');
|
|
71
|
+
console.log('Reason:', detection.result.reason);
|
|
72
|
+
} else {
|
|
73
|
+
console.log('✅ Content is clean');
|
|
74
|
+
}
|
|
75
|
+
} catch (error) {
|
|
76
|
+
console.error('Error:', error.message);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
checkContent();
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## API Documentation
|
|
86
|
+
|
|
87
|
+
### Methods
|
|
88
|
+
|
|
89
|
+
#### `detectProfanities(text: string): Promise<string>`
|
|
90
|
+
|
|
91
|
+
Analyzes text content for profanities and inappropriate language.
|
|
92
|
+
|
|
93
|
+
**Parameters:**
|
|
94
|
+
- `text` (string, required): The text content to analyze
|
|
95
|
+
|
|
96
|
+
**Returns:**
|
|
97
|
+
- Promise<string>: Status URL for polling the job result
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Response Format
|
|
102
|
+
|
|
103
|
+
The API returns a detection result with confidence score:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"data": {
|
|
108
|
+
"type": "api_job_result",
|
|
109
|
+
"id": "a8f2c1b5-9e4d-4a3b-8c7f-6d5e4f3a2b1c",
|
|
110
|
+
"attributes": {
|
|
111
|
+
"status": "success",
|
|
112
|
+
"type": "content_detect_profanities",
|
|
113
|
+
"result": {
|
|
114
|
+
"pass": false,
|
|
115
|
+
"score": 92,
|
|
116
|
+
"reason": "The text contains explicit profanity and offensive language that violates community guidelines."
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Result Fields:**
|
|
124
|
+
- `pass` (boolean): `true` if content is clean, `false` if profanities detected
|
|
125
|
+
- `score` (integer, 0-100): Confidence score of the detection
|
|
126
|
+
- `90-100`: Very high confidence
|
|
127
|
+
- `75-89`: High confidence
|
|
128
|
+
- `60-74`: Moderate confidence
|
|
129
|
+
- `Below 60`: Low confidence (may need human review)
|
|
130
|
+
- `reason` (string): Explanation of why content was flagged or cleared
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Examples
|
|
135
|
+
|
|
136
|
+
### Basic Profanity Detection
|
|
137
|
+
|
|
138
|
+
```javascript
|
|
139
|
+
const { SharpApiDetectProfanitiesService } = require('@sharpapi/sharpapi-node-detect-profanities');
|
|
140
|
+
|
|
141
|
+
const service = new SharpApiDetectProfanitiesService(process.env.SHARP_API_KEY);
|
|
142
|
+
|
|
143
|
+
const content = 'This is a sample user comment to check for inappropriate content.';
|
|
144
|
+
|
|
145
|
+
service.detectProfanities(content)
|
|
146
|
+
.then(statusUrl => service.fetchResults(statusUrl))
|
|
147
|
+
.then(result => {
|
|
148
|
+
const detection = result.getResultJson().result;
|
|
149
|
+
|
|
150
|
+
if (detection.pass) {
|
|
151
|
+
console.log('✅ Content approved');
|
|
152
|
+
} else {
|
|
153
|
+
console.log(`⚠️ Content flagged (${detection.score}% confidence)`);
|
|
154
|
+
console.log(`Reason: ${detection.reason}`);
|
|
155
|
+
}
|
|
156
|
+
})
|
|
157
|
+
.catch(error => console.error('Detection failed:', error));
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Batch Content Moderation
|
|
161
|
+
|
|
162
|
+
```javascript
|
|
163
|
+
const service = new SharpApiDetectProfanitiesService(process.env.SHARP_API_KEY);
|
|
164
|
+
|
|
165
|
+
const userComments = [
|
|
166
|
+
{ id: 1, text: 'Great product! Really helpful.' },
|
|
167
|
+
{ id: 2, text: 'Terrible service, very disappointed.' },
|
|
168
|
+
{ id: 3, text: 'Amazing quality, highly recommend!' }
|
|
169
|
+
];
|
|
170
|
+
|
|
171
|
+
async function moderateComments(comments) {
|
|
172
|
+
const moderated = await Promise.all(
|
|
173
|
+
comments.map(async (comment) => {
|
|
174
|
+
try {
|
|
175
|
+
const statusUrl = await service.detectProfanities(comment.text);
|
|
176
|
+
const result = await service.fetchResults(statusUrl);
|
|
177
|
+
const detection = result.getResultJson().result;
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
...comment,
|
|
181
|
+
approved: detection.pass,
|
|
182
|
+
confidence: detection.score,
|
|
183
|
+
reason: detection.reason,
|
|
184
|
+
requiresReview: !detection.pass && detection.score < 75
|
|
185
|
+
};
|
|
186
|
+
} catch (error) {
|
|
187
|
+
return {
|
|
188
|
+
...comment,
|
|
189
|
+
approved: false,
|
|
190
|
+
error: error.message,
|
|
191
|
+
requiresReview: true
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
})
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
return moderated;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const results = await moderateComments(userComments);
|
|
201
|
+
|
|
202
|
+
const approved = results.filter(r => r.approved).length;
|
|
203
|
+
const flagged = results.filter(r => !r.approved).length;
|
|
204
|
+
const needsReview = results.filter(r => r.requiresReview).length;
|
|
205
|
+
|
|
206
|
+
console.log(`📊 Moderation Summary:`);
|
|
207
|
+
console.log(`Total: ${results.length}`);
|
|
208
|
+
console.log(`✅ Approved: ${approved}`);
|
|
209
|
+
console.log(`⚠️ Flagged: ${flagged}`);
|
|
210
|
+
console.log(`👤 Needs Human Review: ${needsReview}`);
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Real-time Comment Filtering
|
|
214
|
+
|
|
215
|
+
```javascript
|
|
216
|
+
const service = new SharpApiDetectProfanitiesService(process.env.SHARP_API_KEY);
|
|
217
|
+
|
|
218
|
+
async function filterComment(comment, autoReject = true) {
|
|
219
|
+
const statusUrl = await service.detectProfanities(comment.text);
|
|
220
|
+
const result = await service.fetchResults(statusUrl);
|
|
221
|
+
const detection = result.getResultJson().result;
|
|
222
|
+
|
|
223
|
+
const action = {
|
|
224
|
+
commentId: comment.id,
|
|
225
|
+
userId: comment.userId,
|
|
226
|
+
text: comment.text,
|
|
227
|
+
pass: detection.pass,
|
|
228
|
+
confidence: detection.score,
|
|
229
|
+
reason: detection.reason,
|
|
230
|
+
status: '',
|
|
231
|
+
action: ''
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
if (detection.pass) {
|
|
235
|
+
action.status = 'approved';
|
|
236
|
+
action.action = 'publish';
|
|
237
|
+
} else if (detection.score >= 85 && autoReject) {
|
|
238
|
+
action.status = 'rejected';
|
|
239
|
+
action.action = 'auto_reject';
|
|
240
|
+
} else if (detection.score >= 60) {
|
|
241
|
+
action.status = 'flagged';
|
|
242
|
+
action.action = 'hold_for_review';
|
|
243
|
+
} else {
|
|
244
|
+
action.status = 'uncertain';
|
|
245
|
+
action.action = 'manual_review';
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return action;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const newComment = {
|
|
252
|
+
id: 'CMT-12345',
|
|
253
|
+
userId: 'USER-789',
|
|
254
|
+
text: 'What a fantastic experience! Absolutely loved it!'
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const moderation = await filterComment(newComment);
|
|
258
|
+
|
|
259
|
+
console.log(`Comment Status: ${moderation.status}`);
|
|
260
|
+
console.log(`Action: ${moderation.action}`);
|
|
261
|
+
console.log(`Confidence: ${moderation.confidence}%`);
|
|
262
|
+
|
|
263
|
+
if (moderation.action === 'publish') {
|
|
264
|
+
console.log('✅ Comment published successfully');
|
|
265
|
+
} else if (moderation.action === 'auto_reject') {
|
|
266
|
+
console.log('🚫 Comment automatically rejected');
|
|
267
|
+
console.log(`Reason: ${moderation.reason}`);
|
|
268
|
+
} else {
|
|
269
|
+
console.log('⏸️ Comment held for manual review');
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Forum Moderation Dashboard
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
const service = new SharpApiDetectProfanitiesService(process.env.SHARP_API_KEY);
|
|
277
|
+
|
|
278
|
+
async function generateModerationReport(posts) {
|
|
279
|
+
const analyzed = await Promise.all(
|
|
280
|
+
posts.map(async (post) => {
|
|
281
|
+
const statusUrl = await service.detectProfanities(post.content);
|
|
282
|
+
const result = await service.fetchResults(statusUrl);
|
|
283
|
+
const detection = result.getResultJson().result;
|
|
284
|
+
|
|
285
|
+
return {
|
|
286
|
+
postId: post.id,
|
|
287
|
+
author: post.author,
|
|
288
|
+
timestamp: post.timestamp,
|
|
289
|
+
pass: detection.pass,
|
|
290
|
+
score: detection.score,
|
|
291
|
+
reason: detection.reason,
|
|
292
|
+
severity: detection.score >= 90 ? 'high' :
|
|
293
|
+
detection.score >= 75 ? 'medium' :
|
|
294
|
+
detection.score >= 60 ? 'low' : 'uncertain'
|
|
295
|
+
};
|
|
296
|
+
})
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
const report = {
|
|
300
|
+
totalPosts: posts.length,
|
|
301
|
+
clean: analyzed.filter(a => a.pass).length,
|
|
302
|
+
flagged: analyzed.filter(a => !a.pass).length,
|
|
303
|
+
highSeverity: analyzed.filter(a => a.severity === 'high').length,
|
|
304
|
+
mediumSeverity: analyzed.filter(a => a.severity === 'medium').length,
|
|
305
|
+
lowSeverity: analyzed.filter(a => a.severity === 'low').length,
|
|
306
|
+
needsReview: analyzed.filter(a => a.severity === 'uncertain').length,
|
|
307
|
+
posts: analyzed.filter(a => !a.pass).map(a => ({
|
|
308
|
+
postId: a.postId,
|
|
309
|
+
author: a.author,
|
|
310
|
+
severity: a.severity,
|
|
311
|
+
score: a.score,
|
|
312
|
+
reason: a.reason
|
|
313
|
+
}))
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
return report;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const forumPosts = [
|
|
320
|
+
{ id: 'POST-1', author: 'user123', content: 'Great discussion!', timestamp: new Date() },
|
|
321
|
+
{ id: 'POST-2', author: 'user456', content: 'Thanks for sharing!', timestamp: new Date() },
|
|
322
|
+
{ id: 'POST-3', author: 'user789', content: 'Very helpful post.', timestamp: new Date() }
|
|
323
|
+
];
|
|
324
|
+
|
|
325
|
+
const report = await generateModerationReport(forumPosts);
|
|
326
|
+
|
|
327
|
+
console.log('📋 Moderation Report:');
|
|
328
|
+
console.log(`Total Posts: ${report.totalPosts}`);
|
|
329
|
+
console.log(`Clean: ${report.clean}`);
|
|
330
|
+
console.log(`Flagged: ${report.flagged}`);
|
|
331
|
+
console.log(` - High Severity: ${report.highSeverity}`);
|
|
332
|
+
console.log(` - Medium Severity: ${report.mediumSeverity}`);
|
|
333
|
+
console.log(` - Low Severity: ${report.lowSeverity}`);
|
|
334
|
+
console.log(` - Needs Review: ${report.needsReview}`);
|
|
335
|
+
|
|
336
|
+
if (report.posts.length > 0) {
|
|
337
|
+
console.log('\n🚨 Flagged Posts:');
|
|
338
|
+
report.posts.forEach(p => {
|
|
339
|
+
console.log(` - ${p.postId} by ${p.author} (${p.severity} severity, ${p.score}%)`);
|
|
340
|
+
console.log(` Reason: ${p.reason}`);
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Use Cases
|
|
348
|
+
|
|
349
|
+
- **Social Media Platforms**: Moderate user comments and posts
|
|
350
|
+
- **Community Forums**: Enforce community guidelines automatically
|
|
351
|
+
- **Gaming Platforms**: Filter chat messages and usernames
|
|
352
|
+
- **E-commerce**: Screen product reviews and seller messages
|
|
353
|
+
- **Educational Platforms**: Maintain safe learning environments
|
|
354
|
+
- **Dating Apps**: Screen user profiles and messages
|
|
355
|
+
- **Customer Support**: Filter support tickets and feedback
|
|
356
|
+
- **Live Chat**: Real-time message filtering
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## Detection Capabilities
|
|
361
|
+
|
|
362
|
+
The AI analyzes content for:
|
|
363
|
+
|
|
364
|
+
- **Explicit Profanity**: Curse words and vulgar language
|
|
365
|
+
- **Offensive Slurs**: Discriminatory or hate speech
|
|
366
|
+
- **Sexual Content**: Inappropriate sexual references
|
|
367
|
+
- **Harassment**: Threatening or bullying language
|
|
368
|
+
- **Toxic Behavior**: Generally harmful or abusive content
|
|
369
|
+
- **Masked Profanity**: Attempts to bypass filters with symbols or misspellings
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## Integration Tips
|
|
374
|
+
|
|
375
|
+
### Confidence Thresholds
|
|
376
|
+
|
|
377
|
+
Recommended confidence score thresholds:
|
|
378
|
+
|
|
379
|
+
- **≥ 90%**: Auto-reject/block (very high confidence)
|
|
380
|
+
- **75-89%**: Flag for priority review (high confidence)
|
|
381
|
+
- **60-74%**: Queue for review (moderate confidence)
|
|
382
|
+
- **< 60%**: Manual review required (low confidence)
|
|
383
|
+
|
|
384
|
+
### Performance Optimization
|
|
385
|
+
|
|
386
|
+
- Use batch processing for bulk moderation
|
|
387
|
+
- Cache results for repeated content checks
|
|
388
|
+
- Implement queue systems for high-volume scenarios
|
|
389
|
+
- Combine with other moderation tools for comprehensive coverage
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## API Endpoint
|
|
394
|
+
|
|
395
|
+
**POST** `/content/detect_profanities`
|
|
396
|
+
|
|
397
|
+
For detailed API specifications, refer to:
|
|
398
|
+
- [Main API Documentation](https://documenter.getpostman.com/view/31106842/2s9Ye8faUp)
|
|
399
|
+
- [SharpAPI.com](https://sharpapi.com/)
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## Related Packages
|
|
404
|
+
|
|
405
|
+
- [@sharpapi/sharpapi-node-detect-spam](https://www.npmjs.com/package/@sharpapi/sharpapi-node-detect-spam) - Spam detection
|
|
406
|
+
- [@sharpapi/sharpapi-node-detect-phones](https://www.npmjs.com/package/@sharpapi/sharpapi-node-detect-phones) - Phone number extraction
|
|
407
|
+
- [@sharpapi/sharpapi-node-detect-emails](https://www.npmjs.com/package/@sharpapi/sharpapi-node-detect-emails) - Email extraction
|
|
408
|
+
- [@sharpapi/sharpapi-node-detect-urls](https://www.npmjs.com/package/@sharpapi/sharpapi-node-detect-urls) - URL extraction
|
|
409
|
+
- [@sharpapi/sharpapi-node-client](https://www.npmjs.com/package/@sharpapi/sharpapi-node-client) - Full SharpAPI SDK
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## License
|
|
414
|
+
|
|
415
|
+
This project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Support
|
|
420
|
+
|
|
421
|
+
- **Documentation**: [SharpAPI.com Documentation](https://sharpapi.com/documentation)
|
|
422
|
+
- **Issues**: [GitHub Issues](https://github.com/sharpapi/sharpapi-node-client/issues)
|
|
423
|
+
- **Email**: contact@sharpapi.com
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
**Powered by [SharpAPI](https://sharpapi.com/) - AI-Powered API Workflow Automation**
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sharpapi/sharpapi-node-detect-profanities",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SharpAPI.com Node.js SDK for detecting profanities in text",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "jest"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"sharpapi",
|
|
11
|
+
"ai-powered",
|
|
12
|
+
"ai capabilities",
|
|
13
|
+
"api",
|
|
14
|
+
"ai api",
|
|
15
|
+
"api integration",
|
|
16
|
+
"artificial intelligence",
|
|
17
|
+
"natural language processing",
|
|
18
|
+
"restful api",
|
|
19
|
+
"nodejs",
|
|
20
|
+
"software development",
|
|
21
|
+
"content analysis",
|
|
22
|
+
"content moderation",
|
|
23
|
+
"profanity detection",
|
|
24
|
+
"text processing"
|
|
25
|
+
],
|
|
26
|
+
"author": "Dawid Makowski <contact@sharpapi.com>",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@sharpapi/sharpapi-node-core": "file:../sharpapi-node-core"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"jest": "^29.7.0"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/sharpapi/sharpapi-node-detect-profanities.git"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const { SharpApiCoreService, SharpApiJobTypeEnum } = require('@sharpapi/sharpapi-node-core');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Service for detecting profanities in text using SharpAPI.com
|
|
5
|
+
*/
|
|
6
|
+
class SharpApiDetectProfanitiesService extends SharpApiCoreService {
|
|
7
|
+
/**
|
|
8
|
+
* Analyzes the provided text for any profanities or inappropriate language.
|
|
9
|
+
* Useful for content moderation, user-generated content validation, and
|
|
10
|
+
* maintaining community guidelines.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} text
|
|
13
|
+
* @returns {Promise<string>} - The status URL.
|
|
14
|
+
*/
|
|
15
|
+
async detectProfanities(text) {
|
|
16
|
+
const data = { content: text };
|
|
17
|
+
const response = await this.makeRequest('POST', SharpApiJobTypeEnum.CONTENT_DETECT_PROFANITIES.url, data);
|
|
18
|
+
return this.parseStatusUrl(response);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = { SharpApiDetectProfanitiesService };
|