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

v1.2.1

Published

Sentor ML SDK for JavaScript/TypeScript

Downloads

2

Readme

Sentor SDK

A TypeScript/JavaScript SDK for interacting with the Sentor ML API for sentiment analysis. This SDK provides a simple and type-safe interface for sentiment analysis operations.

Features

  • 🚀 TypeScript support with full type definitions
  • ⚡ Simple and intuitive API
  • 🌍 Multi-lingual support (English & Dutch)
  • 📦 Batch processing capabilities
  • 🛡️ Comprehensive error handling
  • 🔄 Real-time sentiment analysis

Get API key

Work like a PRO

  1. Go to Sentor ML API
  2. Subscribe to the Starter plan
  3. Get your API key

Installation

npm install sentor-sdk

Usage

Basic Usage

import { SentorClient } from 'sentor-sdk';

// Initialize the client
const client = new SentorClient('your-api-key');

// Analyze sentiment
const input = 
{
  "docs": [
    {
      "doc": "In the competitive landscape of consumer electronics, Apple and Samsung continue to lead the market with innovative products and strong brand loyalty. While Apple focuses on a tightly integrated ecosystem with devices like the iPhone, iPad, and Mac, Samsung excels in offering a wide range of options across various price points, especially in its Galaxy smartphone lineup. Both companies push the boundaries of technology, from cutting-edge chipsets to advanced camera systems, often setting industry trends that others follow.",
      "doc_id": "0",
      "entities": [
        "Apple",
        "Samsung",
        "camera"
      ]
    },
    {
      "doc": "Apple's new iPhone is amazing!",
      "doc_id": "1",
      "entities": [
        "Apple",
        "iPhone"
      ]
    },
    {
      "doc": "Samsung's new phone is amazing!",
      "doc_id": "2",
      "entities": [
        "Samsung",
        "phone"
      ]
    }
  ]
}
const result = await client.predict(input);
console.log(result);

Multi-lingual Support

The SDK supports multiple languages for sentiment prediction. Currently supported languages are:

  • English (en) - Default language
  • Dutch (nl)
// Predict sentiment in Dutch
const dutchResult = await client.predict({
  docs: [
    {
      doc: "Dit is een geweldig product!",
      doc_id: "1",
      entities: ["product"]
    }
  ],
  language: "nl"  // Specify Dutch language
});

// Predict sentiment in English (default)
const englishResult = await client.predict({
  docs: [
    {
      doc: "This is an amazing product!",
      doc_id: "2", 
      entities: ["product"]
    }
  ]
  // language parameter is optional, defaults to "en"
});

Sample Output

{
  "results": [
    {
      "doc_id": "0",
      "predicted_class": 2,
      "predicted_label": "positive",
      "probabilities": {
        "negative": 0.00007679959526285529,
        "neutral": 0.0002924697764683515,
        "positive": 0.9996306896209717
      },
      "details": [
        {
          "sentence_index": 0,
          "sentence_text": "In the competitive landscape of consumer electronics, Apple and Samsung continue to lead the market with innovative products and strong brand loyalty.",
          "predicted_class": 2,
          "predicted_label": "positive",
          "probabilities": {
            "negative": 0.00009389198385179043,
            "neutral": 0.00032428017584607005,
            "positive": 0.9995818734169006
          }
        },
        {
          "sentence_index": 1,
          "sentence_text": "While Apple focuses on a tightly integrated ecosystem with devices like the iPhone, iPad, and Mac, Samsung excels in offering a wide range of options across various price points, especially in its Galaxy smartphone lineup.",
          "predicted_class": 2,
          "predicted_label": "positive",
          "probabilities": {
            "negative": 0.00005746580063714646,
            "neutral": 0.00012963586777914315,
            "positive": 0.99981290102005
          }
        },
        {
          "sentence_index": 2,
          "sentence_text": "Both companies push the boundaries of technology, from cutting-edge chipsets to advanced camera systems, often setting industry trends that others follow.",
          "predicted_class": 2,
          "predicted_label": "positive",
          "probabilities": {
            "negative": 0.00006366783054545522,
            "neutral": 0.00044553453335538507,
            "positive": 0.9994907379150391
          }
        }
      ]
    },
    {
      "doc_id": "1",
      "predicted_class": 2,
      "predicted_label": "positive",
      "probabilities": {
        "negative": 0.00010637375817168504,
        "neutral": 0.0002509312762413174,
        "positive": 0.9996427297592163
      },
      "details": [
        {
          "sentence_index": 0,
          "sentence_text": "Apple's new iPhone is amazing!",
          "predicted_class": 2,
          "predicted_label": "positive",
          "probabilities": {
            "negative": 0.00010637375817168504,
            "neutral": 0.0002509312762413174,
            "positive": 0.9996427297592163
          }
        }
      ]
    },
    {
      "doc_id": "2",
      "predicted_class": 2,
      "predicted_label": "positive",
      "probabilities": {
        "negative": 0.00010637375817168504,
        "neutral": 0.0002509312762413174,
        "positive": 0.9996427297592163
      },
      "details": [
        {
          "sentence_index": 0,
          "sentence_text": "Samsung's new phone is amazing!",
          "predicted_class": 2,
          "predicted_label": "positive",
          "probabilities": {
            "negative": 0.00010637375817168504,
            "neutral": 0.0002509312762413174,
            "positive": 0.9996427297592163
          }
        }
      ]
    }
  ]
}

API Methods

predict(input: PredictRequest): Promise<PredictResponse>

Predicts sentiment for the provided documents with optional language specification.

Parameters:

  • input.docs: Array of documents to analyze
  • input.language (optional): Language code ('en' or 'nl'). Defaults to 'en'

Returns: Promise with prediction results including probabilities and detailed sentence-level analysis.

checkHealth(): Promise<HealthResponse>

Checks the health status of the Sentor ML API.

Returns: Promise with API health status.

API Reference

Please refer to the Sentor ML API Documentation for more details. You can also try the API in the Sentor ML API Swagger Playground.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see the LICENSE file for details.