Sentor Python SDK
Official Python SDK for the Sentor API — entity-based sentiment analysis, document clustering, and topic naming.
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
pip install sentor-python-sdk
Get a free API key at dashboard.sentor.app.
🚀 Quick Start
from sentor import SentorClient
client = SentorClient("your_api_key")
results = client.predict([
{
"doc_id": "review-1",
"doc": "Apple's new iPhone is amazing but the price is ridiculous.",
"entities": ["Apple", "iPhone", "price"]
}
])
for item in results["results"]:
print(item["doc_id"], item["predicted_label"])
for es in item.get("entity_sentiments", []):
print(f" {es['entity']}: {es['sentiment']} ({es['score']:.2f})")
📖 API Reference
predict(documents, language="en")
Score sentiment toward named entities in one or more documents.
results = client.predict(
documents=[
{
"doc_id": "r1",
"doc": "Samsung's camera is great but battery life is poor.",
"entities": ["Samsung", "camera", "battery life"]
}
],
language="en" # "en" or "nl"
)
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(documents, language="en")
Group 5+ documents into thematic clusters using BERTopic + HDBSCAN.
results = client.cluster(
documents=[
{"doc_id": "r1", "text": "Shipping was incredibly fast.", "entities": ["shipping"]},
# ... at least 5 documents
],
language="en"
)
for cluster in results["clusters"]:
print(cluster["cluster_id"], cluster["document_count"], cluster["top_words"])
# Cluster -1 = outliers that did not fit any topic
generate_topic_name(cluster_id, documents, ...)
Generate a 3–5 word label for a cluster using an LLM.
result = client.generate_topic_name(
cluster_id=0,
documents=cluster["documents"],
top_words=cluster["top_words"],
entities=["BrandName"],
language="en"
)
print(result["topic_name"]) # e.g. "Shipping Delay Complaints"
check_health()
health = client.check_health()
# {"status": "healthy", "version": "...", "llm_status": "available"}
⚠️ Error Handling
from sentor import SentorClient
from sentor.exceptions import SentorAPIError, RateLimitError, AuthenticationError
client = SentorClient("your_api_key")
try:
results = client.predict([...])
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limit hit. Retry after {e.retry_after}s")
except SentorAPIError as e:
print(f"API error: {e.message} (code: {e.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 |
🔄 Migration from sentor-ml
This package replaces sentor-ml. The import name (sentor) and all method signatures are unchanged — only the install command changes:
pip uninstall sentor-ml
pip install sentor-python-sdk
🔗 Links
- Sentor Dashboard — manage API keys and usage
- API Documentation
- PyPI Package
- Support
Built by NIKX Technologies B.V.
Release files for sentor-python-sdk 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sentor_python_sdk-2.0.0.tar.gz | 6.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sentor_python_sdk-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.9 kB
Release files / sentor_python_sdk-2.0.0.tar.gz
| Download URL | sentor_python_sdk-2.0.0.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53befeabad788103f5a09d8709986e157a7a692761fdbf14b1b1eda5c0430827
|
|
BLAKE2b-256 checksum How to use checksums |
cf34d41d2cf96d63a7d36f2ea60d451cb6f05fb9451209a7e7e2eac5ba7c8ee7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 22, 2026.
Transparency logRelease files / sentor_python_sdk-2.0.0-py3-none-any.whl
| Download URL | sentor_python_sdk-2.0.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a9448815453917a489f42c2eda32c139dd457d44d16b2b75823a55231391fa44
|
|
BLAKE2b-256 checksum How to use checksums |
0db03ff8b6c7839996e548a0c6c6fac8b317aa7df5e08f2d41688a2a0068e0e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 22, 2026.
Transparency log