Skip to main content

A Python SDK for interacting with the Sentor ML API for sentiment analysis

Project description

Sentor Python SDK

A Python SDK for interacting with the Sentor ML API for sentiment analysis. This SDK provides a simple and intuitive interface for sentiment analysis operations.

Features

  • 🚀 Python 3.7+ support
  • ⚡ Simple and intuitive API
  • 🌍 Support for multiple languages
  • 📦 Batch processing capabilities
  • 🛡️ Comprehensive error handling
  • 🔄 Real-time sentiment analysis

Installation

pip install sentor-ml

Get API key

Try with guest API key

Get a guest API key to try the API.

curl -X 'POST' \
  'https://ml.sentor.app/api/auth/guest-access' \
  -H 'accept: application/json' \
  -d ''

Work like a PRO

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

Usage

Basic Usage

from sentor import SentorClient

# Initialize the client
client = SentorClient('your-api-key')

# Analyze sentiment
input_data = [
    {
        "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"
        ]
    }
]
result = client.analyze(input_data)
print(result)

Sample Output

{
  "results": [
    {
      "doc_id": "1",
      "predicted_class": 2,
      "predicted_label": "positive",
      "probabilities": {
        "negative": 0.00010637386003509164,
        "neutral": 0.0002509312762413174,
        "positive": 0.9996427297592163
      }
    },
    {
      "doc_id": "2",
      "predicted_class": 2,
      "predicted_label": "positive",
      "probabilities": {
        "negative": 0.00010637386003509164,
        "neutral": 0.0002509312762413174,
        "positive": 0.9996427297592163
      }
    }
  ]
}

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sentor_ml-1.0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sentor_ml-1.0.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file sentor_ml-1.0.1.tar.gz.

File metadata

  • Download URL: sentor_ml-1.0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for sentor_ml-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0be24e6943ac7d62dfc35cd608e6a2e9e4122fa7ae68ef714035fef8cbd211a1
MD5 5a5cfb0f86c30d6f40068c708249b218
BLAKE2b-256 0e4325a5670c703e3a5c010b7e4eed3f50d3e8ce826e60ed3daed9bc9de368fc

See more details on using hashes here.

File details

Details for the file sentor_ml-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: sentor_ml-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for sentor_ml-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4d72492976e9ba206a3ece161e2a07ca44b0d37319df9001fde49de35aec2f64
MD5 8f4e20a693d9267792321aaa9cf59e29
BLAKE2b-256 84391285639dddc477c021b1737d9a06f98aa6c634a6c3e9268ced9bb54ddee6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page