Skip to main content

Structured TextOutcome Generator: A scalable, instance-and company-specific knowledge base and language model-powered solution that uses Natural Language Processing (NLP), Machine Learning (ML) and Hu

Project description

nlp-structgen

PyPI version License: MIT Downloads LinkedIn

nlp-structgen is a lightweight, instance‑agnostic solution that uses NLP, ML and HCI principles to transform unstructured text into structured JSON (and, in local builds, CSV or plain text). It is ideal for automating repetitive data‑entry tasks, generating business charts, building quotes, converting data, and more, while keeping data consistent and auditable.

Features

  • Input validation & consistency checks – ensures the extracted data satisfies a user‑defined regex.
  • Template‑driven output – matches a template to produce consistent JSON structures.
  • LLM integration – defaults to ChatLLM7 from the langchain_llm7 package, but any LangChain‐compatible model can be provided.
  • REST / GraphQL – ready to expose via network APIs.
  • Logging & performance tracking – logs every invocation and can generate performance charts.
  • Export formats – produces JSON by default; local builds can output CSV or plain text.

Installation

pip install nlp_structgen

Quick Start

from nlp_structgen import nlp_structgen

user_input = """
Company: Acme Corp
Employees: 42
Revenue: $5M
"""

results = nlp_structgen(user_input)
print(results)   # -> List containing extracted JSON strings

Using a different LLM

If you prefer a different language model you can pass an instance of any BaseChatModel.
Below are three common examples:

OpenAI

from langchain_openai import ChatOpenAI
from nlp_structgen import nlp_structgen

llm = ChatOpenAI()            # uses your configured OpenAI key
response = nlp_structgen(user_input, llm=llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from nlp_structgen import nlp_structgen

llm = ChatAnthropic()          # uses your configured Anthropic key
response = nlp_structgen(user_input, llm=llm)

Google Gemini

from langchain_google_genai import ChatGoogleGenerativeAI
from nlp_structgen import nlp_structgen

llm = ChatGoogleGenerativeAI()
response = nlp_structgen(user_input, llm=llm)

Customizing the LLM7 API key

nlp_structgen defaults to ChatLLM7.
The free tier rate limits are usually sufficient, but you can provide your own key:

export LLM7_API_KEY="your_api_key_here"

or directly in code:

response = nlp_structgen(user_input, api_key="your_api_key_here")

You can obtain a free key at https://token.llm7.io/.

Parameters

Parameter Type Description
user_input str Text to process
api_key Optional[str] LLM7 API key, if not supplied the environment variable LLM7_API_KEY or the default will be used
llm Optional[BaseChatModel] An instance of a LangChain chat model; if omitted, ChatLLM7 will be instantiated

License

This project is licensed under the MIT license – see the LICENSE file for details.

Author

Eugene Evstafev
Email: hi@euegne.plus
GitHub: chigwell

Contributing

Feel free to open an issue or pull request on https://github.com/chigwell/nlp-structgen/issues.


Disclaimer: All information provided here is based solely on the package’s public code and documentation. No additional facts have been fabricated.

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

nlp_structgen-2025.12.20202749.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

nlp_structgen-2025.12.20202749-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file nlp_structgen-2025.12.20202749.tar.gz.

File metadata

  • Download URL: nlp_structgen-2025.12.20202749.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for nlp_structgen-2025.12.20202749.tar.gz
Algorithm Hash digest
SHA256 a6ac59ee838209186528c8d1bc1b84e7b510e7074b30b8f19b11826e57fd0197
MD5 47b5b30e4b2b01e3e58eae7c5ebf3b2c
BLAKE2b-256 bcf1fcb4cb77d996023174108b3d625b799c20ecc0a4ac0e618c4fdffb284691

See more details on using hashes here.

File details

Details for the file nlp_structgen-2025.12.20202749-py3-none-any.whl.

File metadata

File hashes

Hashes for nlp_structgen-2025.12.20202749-py3-none-any.whl
Algorithm Hash digest
SHA256 33ec9dea1f21c3b906813494b6848375cec131dae62c2400d0cf6a529d5ca62a
MD5 49d83cf5615988e82b0b2cf7730489ea
BLAKE2b-256 31fef0987d3c18f15a5057bcceb85f926b92e82066af7ff09435213a8ea1fbc5

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