5.0.0 • Published 5 months ago

toxicity-analyzer v5.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Toxicity Analyzer

Perspective Analyzer is a TypeScript library that provides a convenient interface to analyze text and images using the Perspective API. The library includes modules for text and image analysis, offering a comprehensive solution for content moderation.

Analyzing Text

import { PerspectiveClient, AnalyzeCommentOptions, AnalyzeCommentResponse, SupportedLanguage } from 'perspective-analyzer';

const perspectiveApiKey = 'YOUR_PERSPECTIVE_API_KEY';
const rapidApiKey = 'YOUR_RAPID_API_KEY'; // Optional

const client = new PerspectiveClient(perspectiveApiKey, rapidApiKey);

const options: AnalyzeCommentOptions = {
  comment: 'Your text goes here',
  language: SupportedLanguage.English,
  autoLanguage: true, // Optional, default is false
};

try {
  const result: AnalyzeCommentResponse = await client.analyzeComment(options);
  console.log('Analysis result:', result);
} catch (error) {
  console.error('Error analyzing text:', error.message);
}

Analyzing Images

import { analyzeImage, ImageAnalyzerOptions, ImageAnalyzerResponse } from 'perspective-analyzer';

const options: ImageAnalyzerOptions = {
  apiKey: 'YOUR_MODERATE_CONTENT_API_KEY',
  proxyURL: 'https://www.exampleImage.com',
};

try {
  const result: ImageAnalyzerResponse = await analyzeImage(options);
  console.log('Image analysis result:', result);
} catch (error) {
  console.error('Error analyzing image:', error.message);
}

Error Handling

The library provides various error classes for better error management. Make sure to handle errors appropriately in your application.

License

This project is licensed under the MIT License - see the LICENSE file for details.

5.0.0

5 months ago

3.0.0-beta.1

10 months ago

3.0.0-beta.3

10 months ago

3.0.0-beta.2

10 months ago

3.0.0-beta.5

10 months ago

3.0.0

10 months ago

3.0.0-beta.4

10 months ago

3.0.0-beta.7

10 months ago

3.0.0-beta.6

10 months ago

3.0.0-beta.9

10 months ago

3.0.0-beta.8

10 months ago

4.0.0

10 months ago

3.0.0-beta.10

10 months ago

3.0.0-beta.11

10 months ago

3.0.0-beta.12

10 months ago

2.0.1

10 months ago

1.0.2

1 year ago

2.0.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago