Geneea NLP Client SDK
A Python SDK for the Geneea Interpretor - a Natural Language Processing REST API that extracts linguistic insights from text documents.
Features
The SDK provides access to Geneea's NLP capabilities including language detection, named entity recognition (persons, organizations, locations), semantic tagging, sentiment analysis, and relationship extraction between entities.
Installation
pip install geneea-nlp-client
Supports Python 3.10 - 3.14.
Quick Start
from geneeanlpclient import g3
# Create a request builder with desired analyses
builder = g3.Request.Builder(
analyses=[g3.AnalysisType.ENTITIES, g3.AnalysisType.SENTIMENT]
)
# Analyze text using the API client
with g3.Client.create(userKey="YOUR_API_KEY") as client:
analysis = client.analyze(builder.build(
id="doc1",
text="Angela Merkel visited Paris last Tuesday."
))
# Access results
for entity in analysis.entities:
print(f"{entity.type}: {entity.stdForm}")
if analysis.docSentiment:
print(f"Sentiment: {analysis.docSentiment.label}")
You can also set the API key via the GENEEA_API_KEY environment variable.
Analysis Types
| Type | Description |
|---|---|
ENTITIES |
Named entity recognition |
TAGS |
Semantic tagging and topic extraction |
RELATIONS |
Entity relationships and attributes |
SENTIMENT |
Sentiment analysis |
LANGUAGE |
Language detection |
ALL |
All analyses |
Advanced Usage
Structured document input:
builder = g3.Request.Builder(analyses=[g3.AnalysisType.ALL])
request = builder.build(
id="article1",
paraSpecs=[
g3.ParaSpec.title("Author Elena Marsh Releases New Historical Novel"),
g3.ParaSpec.lead("The acclaimed writer returns with a story set in 19th century Prague."),
g3.ParaSpec.body("First paragraph of the article."),
g3.ParaSpec.body("Second paragraph of the article.")
]
)
Note: The Interpretor (General API) can accept any number of paragraphs, but always returns at most one of each type: title, lead, and body. For title and lead this is usually not a limitation (there is typically only one of each), but if there are multiple body paragraphs in the input, they are concatenated into a single body paragraph with "\n\n" as separator in the output.
Domain-specific analysis:
builder = g3.Request.Builder(
analyses=[g3.AnalysisType.ENTITIES, g3.AnalysisType.TAGS],
domain=g3.Domain.NEWS, # News media articles
language=g3.LanguageCode.EN
)
With item-level sentiment and mentions:
builder = g3.Request.Builder(
analyses=[g3.AnalysisType.ENTITIES, g3.AnalysisType.SENTIMENT],
returnMentions=True,
returnItemSentiment=True
)
Working with results:
# Iterate through document structure
for paragraph in analysis.paragraphs:
print(f"Paragraph type: {paragraph.type}")
for sentence in paragraph.sentences:
print(f" Sentence: {sentence.text}")
print(f" First word: {sentence.tokens[0].text}")
# Entity mentions with positions
for entity in analysis.entities:
for mention in entity.mentions:
print(f"{entity.stdForm} found at: {mention.tokens.charSpan}")
Dependencies
requests~=2.25- HTTP communicationpandas>=0.22(optional) - For example scripts with Excel export
Development
The SDK is built using Bitbucket Pipelines. The pipelines are run at least once a month to keep the SonarQube token valid.
Documentation
License
Apache License 2.0
Release files for geneea-nlp-client 1.7.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 | |
|---|---|---|---|
| geneea_nlp_client-1.7.0.tar.gz | 41.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| geneea_nlp_client-1.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 88.8 kB
Release files / geneea_nlp_client-1.7.0.tar.gz
| Download URL | geneea_nlp_client-1.7.0.tar.gz |
|---|---|
| Size | 41.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3fafdae805b6e1d249587ba1ccfe5eb85d7ce40fc71eceb097117ecbcb8fdffb
|
|
BLAKE2b-256 checksum How to use checksums |
fdf5618766905117df49a82fc307cc767364c587ba1666af7d4b613f311e76b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.20
|
Release files / geneea_nlp_client-1.7.0-py3-none-any.whl
| Download URL | geneea_nlp_client-1.7.0-py3-none-any.whl |
|---|---|
| Size | 47.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5ecdfcb0282091a0530ac2373437be49905b67476a270f0bf724fe0d396daa6
|
|
BLAKE2b-256 checksum How to use checksums |
e6b0685d07a85d430cabd022311936e47e56c3e855d4af059c13a09e8283c013
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.20
|