Skip to content

Colorize HTML texts by analyzing each sentence's sentiment using Cohere NLP model.

Notifications You must be signed in to change notification settings

peterkejun/Cohere-Sentimentify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cohere Sentimentify

npm version

Colorize HTML texts by analyzing each sentence's sentiment using Cohere NLP model.

Screenshot of the example app

Installation

npm i cohere-sentimentify

Co:here API Key

cohere-sentimentify uses the finance-sentiment NLP classification model by Co:here, therefore the client application needs to apply an API key. However, this model is accessible using the trial API key, with a limit of 100 calls / minute.

Usage

cohere-sentimentify takes in HTML as a string and produces a new HTML with the same text content and similar DOM structure but with colors (based on sentence sentiment)

import { intialize, sentimentifyHtml } from  'cohere-sentimentify';
import { readFileSync } from  'fs';

(async () => {
	const  API_KEY  =  process.env.API_KEY;
	intialize(API_KEY);
	
	const  html  =  readFileSync('./examples/email.html', 'utf-8');
	const  colorizedHtml  =  await  sentimentifyHtml(html);
	
	console.log(colorizedHtml);
})();

License

This project is under the MIT license.

Contributions

All contributions are welcomed!

About

Colorize HTML texts by analyzing each sentence's sentiment using Cohere NLP model.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published