Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@qrvey/text-analytics

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qrvey/text-analytics

A powerful text analytics library that provides easy integration with AWS Comprehend and Azure Text Analytics for language detection, sentiment analysis, entity recognition, and key phrase extraction.

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
492
increased by56.19%
Maintainers
0
Weekly downloads
 
Created
Source

@qrvey/text-analytics

A powerful text analytics library that provides easy integration with AWS Comprehend and Azure Text Analytics for language detection, sentiment analysis, entity recognition, and key phrase extraction.

Require environment variables


AWS_DEFAULT_REGION; //AWS Region for SQS service
AWS_ACCESS_KEY_ID; //AWS Access key for Event Bridge service
AWS_SECRET_ACCESS_KEY; //AWS Secret key for Event Bridge service
PLATFORM_TYPE; //Platform type (possible value CONTAINER)
CLOUD_PROVIDER; // Cloud service. Possible values azure, aws

Table of Contents

Installation

You can install the @qrvey/text-analytics package via npm. Run the following command in your terminal:

npm install @qrvey/text-analytics

Usage

import TextAnalyticsServiceFactory from '@qrvey/text-analytics';

async function main() {
    const textAnalyticsService = await TextAnalyticsServiceFactory.createTextAnalyticsService();
    const language = await textAnalyticsService.detectLanguage('This is a sample text.');
    console.log(language);
}

API Documentation

textAnalyticsService

The TextAnalyticsService provides methods for text analysis.

detectLanguage

Detects the dominant language of the provided text.

Parameters:

text: A string containing the text to analyze.

Returns

A promise that resolves to an object implementing IDetectDominantLanguageOutput.

detectLanguage(text: string): Promise<IDetectEntityOutput>

interface IDetectDominantLanguageOutput {
    code: string;
    score: number;
}

detectEntities

Detects entities in the provided text.

Parameters:

text: A string containing the text to analyze.

Returns

A promise that resolves to an object implementing IDetectEntityOutput.

detectEntities(text: string): Promise<IDetectEntityOutput>;

interface IDetectEntityOutput {
    entities: Entity[];
}

detectSentiment

Analyzes the sentiment of the provided text.

Parameters:

text: A string containing the text to analyze.

Returns:

A promise that resolves to an object implementing IDetectSentimentOutput.

detectSentiment(text: string): Promise<IDetectSentimentOutput>;

interface IDetectSentimentOutput {
    sentiment: string;
    score: {
        negative: number;
        positive: number;
        neutral: number;
        mixed: number;
    };
}

detectKeyPhrases

Detects key phrases in the provided text.

Parameters:

text: A string containing the text to analyze.

Returns

A promise that resolves to an object implementing IKeyPhraseOutput.

detectKeyPhrases(text: string): Promise<IDetectKeyPhraseOutput>;

interface IDetectKeyPhraseOutput {
    keyPhrases: {
        text: string;
        score: number;
    }[]
}

textAnalysisComplete

Completes a full analysis of the provided text, including language detection, entity detection, sentiment analysis, and key phrase extraction.

Parameters:

text: A string containing the text to analyze.

Returns:

A promise that resolves to an object implementing ICompleteTextAnalysisOutput.

 textAnalysisComplete(text: string): Promise<ICompleteTextAnalysisOutput>;

interface ICompleteTextAnalysisOutput {
    language: IDetectDominantLanguageOutput;
    entities: IDetectEntityOutput;
    sentiment: IDetectSentimentOutput;
    keyPhrases: IKeyPhrase[];
}

Keywords

FAQs

Package last updated on 23 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc