Next Perpendicular Moonlanding

    @types/sentiment
    TypeScript icon, indicating that this package has built-in type declarations

    5.0.1 • Public • Published

    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.

    Keywords

    none

    Install

    npm i @types/sentiment

    DownloadsWeekly Downloads

    614

    Version

    5.0.1

    License

    MIT

    Unpacked Size

    5.39 kB

    Total Files

    4

    Last publish

    Collaborators

    • types