[go: nahoru, domu]

Skip to content

Instantly share code, notes, and snippets.

@harihara6
Created March 26, 2022 13:55
Show Gist options
  • Save harihara6/a467a9e37d32f82f1dabb6bd0262c305 to your computer and use it in GitHub Desktop.
Save harihara6/a467a9e37d32f82f1dabb6bd0262c305 to your computer and use it in GitHub Desktop.
Analyse the data
import * as AWSComprehend from "@aws-sdk/client-comprehend";
import { LanguageServiceClient } from '@google-cloud/language';
//Analyse using GCP
const [result] = await client.analyzeSentiment({document : {
content : item.toProcessString,
type : 'PLAIN_TEXT',
language: 'en'
}});
//Analyse using AWS
const comprehendClient = new AWSComprehend.Comprehend({ region: "ap-south-1" });
const awsSentimentResult = await comprehendClient.detectSentiment({
LanguageCode : 'en',
Text: item.toProcessString
}) as AWSComprehend.DetectSentimentResponse;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment