juicy-chat-bot
Version:
A light-weight and totally "secure" library to easily deploy simple chat bots
41 lines (40 loc) • 1.15 kB
TypeScript
import SentimentAnalyzer from './sentiment-analyzer';
type SentimentManagerSettings = Record<string, any>;
/**
* Class for the sentiment anlysis manager, able to manage
* several different languages at the same time.
*/
export interface SentimentResult {
score: number;
average: number;
numWords: number;
numHits: number;
type: string;
locale: string;
}
interface TranslatedSentiment {
score: number;
comparative: number;
vote: 'positive' | 'negative' | 'neutral';
numWords: number;
numHits: number;
type: string;
language: string;
}
/**
* Class for the sentiment anlysis manager, able to manage
* several different languages at the same time.
*/
declare class SentimentManager {
settings: SentimentManagerSettings;
languages: Record<string, any>;
analyzer: SentimentAnalyzer;
/**
* Constructor of the class.
*/
constructor(settings?: SentimentManagerSettings);
addLanguage(): void;
translate(sentiment: SentimentResult): TranslatedSentiment;
process(locale: string, phrase: string): Promise<TranslatedSentiment>;
}
export default SentimentManager;