npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sentor-sdk

v2.0.0

Published

Official JavaScript/TypeScript SDK for the Sentor API — entity-based sentiment analysis, document clustering, and topic naming

Downloads

20

Readme

Sentor JS/TS SDK

Official JavaScript/TypeScript SDK for the Sentor API — entity-based sentiment analysis, document clustering, and topic naming.

npm License GitHub Stars Website Dashboard Docs

Stop guessing why ratings drop. Sentor pinpoints exactly how customers feel about specific entities — brands, products, features, competitors — using fine-tuned BERT models trained for aspect-based sentiment analysis.


Table of Contents


📦 Installation

npm install sentor-sdk
# or
yarn add sentor-sdk

Get a free API key at dashboard.sentor.app.


🚀 Quick Start

import { SentorClient } from 'sentor-sdk';

const client = new SentorClient('your_api_key');

const results = await client.predict({
    docs: [
        {
            doc_id: 'review-1',
            doc: "Apple's new iPhone is amazing but the price is ridiculous.",
            entities: ['Apple', 'iPhone', 'price'],
        },
    ],
});

for (const item of results.results) {
    console.log(item.doc_id, item.predicted_label);
    for (const es of item.entity_sentiments ?? []) {
        console.log(`  ${es.entity}: ${es.sentiment} (${es.score.toFixed(2)})`);
    }
}

📖 API Reference

predict(input)

Score sentiment toward named entities in one or more documents.

const results = await client.predict({
    docs: [
        {
            doc_id: 'r1',
            doc: "Samsung's camera is great but battery life is poor.",
            entities: ['Samsung', 'camera', 'battery life'],
        },
    ],
    language: 'en', // "en" | "nl", default "en"
});

Response shape:

{
    results: [
        {
            doc_id: 'r1',
            predicted_class: 0,         // 0=negative, 1=neutral, 2=positive
            predicted_label: 'negative',
            probabilities: { negative: 0.72, neutral: 0.18, positive: 0.10 },
            details: [...],             // per-sentence breakdown
            entity_sentiments: [
                { entity: 'Samsung', sentiment: 'neutral', score: 0.61 },
                { entity: 'camera', sentiment: 'positive', score: 0.88 },
                { entity: 'battery life', sentiment: 'negative', score: 0.91 },
            ],
        },
    ],
}

Supported languages: en (English), nl (Dutch)


cluster(input, language?)

Group 5+ documents into thematic clusters using BERTopic + HDBSCAN.

const results = await client.cluster(
    {
        documents: [
            { doc_id: 'r1', text: 'Shipping was incredibly fast.', entities: ['shipping'] },
            // ... at least 5 documents
        ],
    },
    'en'
);

for (const cluster of results.clusters) {
    console.log(cluster.cluster_id, cluster.document_count, cluster.top_words);
}
// cluster_id -1 = outliers that did not fit any topic

generateTopicName(input, language?)

Generate a 3–5 word label for a cluster using an LLM.

const result = await client.generateTopicName(
    {
        cluster_id: 0,
        documents: cluster.documents,
        top_words: cluster.top_words,
        entities: ['BrandName'],
    },
    'en'
);
console.log(result.topic_name); // e.g. "Shipping Delay Complaints"

checkHealth()

const health = await client.checkHealth();
// { status: 'healthy', version: '...', llm_status: 'available' }

⚠️ Error Handling

import { SentorClient, SentorAPIError, RateLimitError, AuthenticationError } from 'sentor-sdk';

const client = new SentorClient('your_api_key');

try {
    const results = await client.predict({ docs: [...] });
} catch (error) {
    if (error instanceof AuthenticationError) {
        console.error('Invalid API key');
    } else if (error instanceof RateLimitError) {
        console.error(`Rate limit hit. Retry after ${error.retryAfter}s`);
    } else if (error instanceof SentorAPIError) {
        console.error(`API error: ${error.message} (${error.code})`);
    }
}

📊 Rate Limits

| Plan | Per Minute | Per Day | Per Month | |------|-----------|---------|-----------| | Free | 5 | 100 | 1,000 | | Starter | 20 | 600 | 5,000 | | Growth | 60 | 3,000 | 25,000 | | Business | 200 | 10,000 | 100,000 | | Enterprise | 500 | 30,000 | 500,000 |

View full pricing →


🔗 Links