5.0.4 • Published 6 months ago
@types/sentiment v5.0.4
Installation
npm install --save @types/sentiment
Summary
This package contains type definitions for sentiment (https://github.com/thisandagain/sentiment).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sentiment.
index.d.ts
// Type definitions for sentiment 5.0
// Project: https://github.com/thisandagain/sentiment
// Definitions by: Isaac Ong <https://github.com/iojw>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = Sentiment;
declare class Sentiment {
constructor(options?: Sentiment.SentimentOptions);
analyze(
phrase: string,
options?: Sentiment.AnalysisOptions,
callback?: (err: string, result: Sentiment.AnalysisResult) => void,
): Sentiment.AnalysisResult;
registerLanguage(languageCode: string, language: Sentiment.LanguageModule): void;
}
declare namespace Sentiment {
// No options supported currently
// tslint:disable-next-line no-empty-interface
interface SentimentOptions {}
interface LanguageModule {
labels: {
[token: string]: number;
};
scoringStrategy?: {
apply: (tokens: string[], cursor: number, tokenScore: number) => number;
} | undefined;
}
interface AnalysisOptions {
extras?: {
[token: string]: number;
} | undefined;
language?: string | undefined;
}
interface AnalysisResult {
score: number;
comparative: number;
calculation: Array<{
[token: string]: number;
}>;
tokens: string[];
words: string[];
positive: string[];
negative: string[];
}
}
Additional Details
- Last updated: Tue, 06 Jul 2021 16:34:34 GMT
- Dependencies: none
- Global values: none
Credits
These definitions were written by Isaac Ong.