Skip to main content

TextTools is a high-level NLP toolkit built on top of modern LLMs.

Project description

TextTools

📌 Overview

TextTools is a high-level NLP toolkit built on top of modern LLMs.
It provides ready-to-use utilities for translation, question detection, keyword extraction, categorization, NER extractor, and more — designed to help you integrate AI-powered text processing into your applications with minimal effort.


✨ Features

TextTools provides a rich collection of high-level NLP utilities built on top of LLMs.
Each tool is designed to work out-of-the-box with structured outputs (JSON / Pydantic).

  • Categorizer → Zero-finetuning text categorization for fast, scalable classification.
  • Keyword Extractor → Identify the most important keywords in a text.
  • Question Merger → Merge the provided questions, preserving all the main points
  • NER (Named Entity Recognition) Extractor → Extract people, places, organizations, and other entities.
  • Question Detector → Determine whether a text is a question or not.
  • Question Generator From Text → Generate high-quality, context-relevant questions from provided text.
  • Question Generator From Subject → Generate high-quality, context-relevant questions from a subject.
  • Rewriter → Rewrite text while preserving meaning or without it.
  • Summarizer → Condense long passages into clear, structured summaries.
  • Translator → Translate text across multiple languages, with support for custom rules.

🔍 with_analysis Mode

The with_analysis=True flag enhances the tool's output by providing a detailed reasoning chain behind its result. This is valuable for debugging, improving prompts, or understanding model behavior.

Please be aware: This feature works by making an additional LLM API call for each tool invocation, which will effectively double your token usage for that operation.


🚀 Installation

Install the latest release via PyPI:

pip install -U hamta-texttools

⚡ Quick Start

from openai import OpenAI

from texttools import TheTool

# Create your OpenAI client
client = OpenAI(base_url = "your_url", API_KEY = "your_api_key")

# Specify the model
model = "gpt-4o-mini"

# Create an instance of TheTool
# ⚠️ Note: Enabling `with_analysis=True` provides deeper insights but incurs additional LLM calls and token usage.
the_tool = TheTool(client = client, model = model, with_analysis = True)

# Example: Question Detection
print(the_tool.detect_question("Is this project open source?")["result"])
# Output: True

# Example: Translation
print(the_tool.translate("سلام، حالت چطوره؟")["result"])
# Output: "Hi! How are you?"

📚 Use Cases

Use TextTools when you need to:

  • 🔍 Classify large datasets quickly without model training
  • 🌍 Translate and process multilingual corpora with ease
  • 🧩 Integrate LLMs into production pipelines (structured outputs)
  • 📊 Analyze large text collections using embeddings and categorization
  • ⚙️ Automate common text-processing tasks without reinventing the wheel

🤝 Contributing

Contributions are welcome!
Feel free to open issues, suggest new features, or submit pull requests.


License

This project is licensed under the 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

hamtaa_texttools-1.0.1.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

hamtaa_texttools-1.0.1-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hamtaa_texttools-1.0.1.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for hamtaa_texttools-1.0.1.tar.gz
Algorithm Hash digest
SHA256 051b3dc6cefd14c04ad31db0c83ecb836e82967212a23731da0fa975be47f7d0
MD5 b61e8a8ff969ca3f0ff640da3f73345c
BLAKE2b-256 6b1cc71f6c4e5eee41a2c6a5a79c6f8a86b70cd12ef1699ec59a0372f789cefe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hamtaa_texttools-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cb93c582821ee68bfacd5d35b488a3a79e7ee7e0e04ac59cd20074e47f768ac9
MD5 7fd70b52fcf929afa5f3975fa437a145
BLAKE2b-256 4babebd273690ea1cfaf4f730bc7a2ac6032d41767285c3b37df73e2a4e31673

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