Skip to main content

Uni9ja Intent Classifier

A lightweight, high-performance Intent Classification library built on PyTorch and SpaCy. This library allows you to identify user intentions in text using word embeddings.

🛠 Features

  • Three-Mode Logic: Use our pretrained model, fine-tune it with your data, or train a new one from scratch.
  • SpaCy Integration: Uses en_core_web_md for high-quality semantic vectors.
  • Auto-Adaptive Architecture: Automatically rebuilds the model head if you add new intent categories during fine-tuning.
  • Production Ready: Includes Early Stopping, Learning Rate Scheduling, and Dropout for regularization.

Installation

  1. Clone the repository:
git clone https://github.com/your-username/uni9ja_intent.git
cd uni9ja_intent
  1. Install the library:
pip install -e .
  1. Download the language model:
python -m spacy download en_core_web_md

Usage Guide

1. Using the Pretrained Model (Inference)

If you just want to use the model out of the box to predict intents:

from uni9ja_intent import IntentModel

# Initialize and load weights
model = IntentModel()
model.load_model("pretrained/uni9ja_intent.pth")

# Predict
intent, confidence = model.predict("How do I sign up for the project?")
print(f"Intent: {intent} ({confidence:.2%})")

2. Fine-tuning with New Data

Use this when you want the model to keep its old knowledge but learn a few new phrases or categories.

new_data = [
    {"text": "I want to hire a freelancer", "label": "hire_request"},
    {"text": "Is there a discount for students?", "label": "pricing_query"}
]

model.finetune(new_data, epochs=20, save_path="pretrained/uni9ja_intent_v2.pth")

3. Training from Scratch (Custom Logic)

Use this if you have a completely different dataset and want to build a brand new brain.

my_custom_data = [
    {"text": "What is the weather?", "label": "weather"},
    {"text": "Play some music", "label": "media_control"},
    # ... more data
]

# Passing data to __init__ triggers the training setup
model = IntentModel(data=my_custom_data, hidden_dims=[256, 128], dropout=0.4)
model.train(epochs=100)
model.save_model("my_custom_model.pth")

Project Structure

.
├── pretrained/           # Saved .pth model checkpoints
├── uni9ja_intent/        # Core Library Source
│   ├── __init__.py       # Package entry point
│   ├── model.py          # PyTorch Neural Network Architecture
│   ├── trainer.py        # IntentModel Manager Class
│   └── spacy_loader.py   # Vectorization logic
├── setup.py              # Pip installation script
└── requirements.txt      # Dependencies

Configuration Parameters

Parameter Default Description
hidden_dims [128, 64] The size of the hidden layers in the MLP.
dropout 0.3 Probability of dropping neurons (prevents overfitting).
threshold 0.6 Minimum confidence score to return a label.

Pro-Tip for Terminal Users

To see your folder structure like the one in this documentation, remember to use the command we set up earlier: tree -I '__pycache__|.git'

Would you like me to create a test.py script for you that automatically verifies if all these features are working correctly?

Loading Data in Code

You can now load your files directly using the built-in utility:

Python from uni9ja_intent import IntentModel, load_data

1. Load data from file

training_data = load_data("path/to/your_data.json")

2. Feed it to the model

model = IntentModel(data=training_data) model.train(epochs=50)

Metadata

Release files for uni9ja-intent 0.1.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 uni9ja-intent 0.1.0
File Size Uploaded Provenance
uni9ja_intent-0.1.0.tar.gz 8.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for uni9ja-intent 0.1.0
File Interpreter ABI Platform
uni9ja_intent-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 kB

Release files / uni9ja_intent-0.1.0.tar.gz

Download URL uni9ja_intent-0.1.0.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f7248ccbc692270ff646dcc8e7f549fbe3e5f2b65422bba5f146ce2dbe68bf22
BLAKE2b-256 checksum
How to use checksums
a8cd3596295bfc0679da8617f82a3123756993f8735d72acf9a99083afae56b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.9

Release files / uni9ja_intent-0.1.0-py3-none-any.whl

Download URL uni9ja_intent-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19881ac348d97b5784b1d0c44200263baf72c8c0cd6a04639238945f039ff09b
BLAKE2b-256 checksum
How to use checksums
10176ee150c3878b10de76f9499ab14a381fa5b83ce98410c9cd4220dd1a4a8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.9

Security for uni9ja-intent 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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