Skip to main content

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 communication
  • pandas>=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)

Source distribution for geneea-nlp-client 1.7.0
File Size Uploaded
geneea_nlp_client-1.7.0.tar.gz 41.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for geneea-nlp-client 1.7.0
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files

1.6.0

1 release file

1.5.2

1 release file

1.5.1

2 release files

1.5.0

2 release files

1.4.4

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page