# @types/sentiment

> TypeScript definitions for sentiment

Latest version **5.0.4** (published 2023-11-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/sentiment
pnpm add @types/sentiment
yarn add @types/sentiment
bun add @types/sentiment
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 5.0.4 |
| Published | 2023-11-21 |
| First published | 2020-05-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51445 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/sentiment
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sentiment
- npm.io page: https://npm.io/package/@types/sentiment

## Recent versions

- 5.0.4 (latest) — 2023-11-21
- 5.0.1 (ts3.6) — 2021-07-06
- 5.0.0 (ts3.0) — 2020-05-30
- 5.0.3 — 2023-11-07
- 5.0.2 — 2023-10-18

## README

# 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](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sentiment/index.d.ts)
````ts
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
    // eslint-disable-next-line @typescript-eslint/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: Mon, 20 Nov 2023 23:36:24 GMT
 * Dependencies: none

# Credits
These definitions were written by [Isaac Ong](https://github.com/iojw).

---
_Source: https://npm.io/package/@types/sentiment · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
