Skip to main content

🥞 Banhxeo: A Simple, Efficient (Enough), and Educational NLP Library

WARNING: Banhxeo cannot be used (and will never be used) for production.

Welcome to Banhxeo!

Just like its namesake – a delicious, crispy Vietnamese savory pancake that's delightful to make and eat – Banhxeo aims to be an NLP library that's:

  • Simple & Understandable: I believe in clarity. Many core NLP concepts and models are implemented from scratch (or close to it!) so you can see exactly what's going on under the hood. No black boxes here!
  • Efficient (Just Enough): While our primary goal is learning, we leverage PyTorch for neural models to ensure reasonable performance for your experiments and projects.
  • Educational at Heart: Banhxeo is designed for learners, educators, and anyone curious about how NLP models work. We encourage you to dive into the code, experiment, and build your understanding.

Think of Banhxeo as your kitchen for cooking up NLP models. We provide the basic ingredients (core components like tokenizers, vocabularies) and some foundational recipes (N-grams, MLPs, and more to come!). You're encouraged to get your hands dirty, modify the recipes, and even create your own!

✨ Philosophy

Our core philosophy revolves around three pillars:

  1. Simplicity: We strive for a clean, modular, and Pythonic codebase. Configurations are explicit, and APIs are designed to be intuitive.
  2. From-Scratch Learning: Many fundamental algorithms and model architectures are built with minimal reliance on high-level abstractions from other large libraries. This transparency is key for genuine understanding. If you've ever wondered "How does an N-gram model actually count things?" or "What are the layers inside a basic MLP for text classification?", Banhxeo is for you.
  3. Practical Efficiency: We use PyTorch as the backbone for our neural network models, allowing you to train and run models with decent speed, especially if you have a GPU.

🚀 Getting Started

  1. Installation:
# Install with pip (we recommend using uv to manage environment)
pip install banhxeo 
# Or build by your self
git clone https://github.com/vietfood/banhxeo.git
cd banhxeo
uv sync
  1. A Quick Start
from banhxeo.dataset import IMDBDataset
from banhxeo.core.tokenizer import NLTKTokenizer, TokenizerConfig
from banhxeo.core.vocabulary import Vocabulary
from banhxeo.models.neural.mlp import MLP, MLPConfig
from banhxeo.training.trainer import Trainer, TrainerConfig

# --- Load Data ---
raw_imdb = IMDBDataset(root_dir="./", split="train")

# -- Create Tokenizer and Vocab ---
tokenizer = NLTKTokenizer()
vocab = Vocabulary.build(corpus=raw_imdb.text_data, tokenizer=tokenizer)

# -- Train MLP ---
  1. Use our Examples

🗺️ Roadmap

Banhxeo is an ongoing project. Here's a glimpse of where we're headed. We welcome contributions and ideas!

  • Vocabulary system
    • Basic system
    • Maybe there is something more
  • Tokenizer system
    • Basic system
    • NLTK Tokenizer wrapper
    • HuggingFace Tokenizer wrapper
    • BPE from scratch (Greedy and Dynamic version, maybe ?)
  • Flexible TextDataset base class with Hugging Face integration.
  • TorchDataset wrapper for PyTorch DataLoader.
  • Initial Models:
    • N-gram
    • MLP for text classification
    • RNN
    • LSTM
    • GPT-2
    • Word2Vec
  • Trainer class:
    • User-defined training step.
    • Callback system for logging (console, file, W&B).
    • Checkpointing.
  • Comprehensive documentation for all core modules.
  • More examples and tutorials for common NLP tasks.
  • Add test (Important)

🤝 Contributing

We'd love for you to contribute to Banhxeo! Whether it's fixing a bug, adding a new model, improving documentation, or suggesting an idea, your help is welcome.

📜 License

Banhxeo is licensed under the MIT License.

Metadata

Release files for banhxeo 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for banhxeo 0.1.3
File Size Uploaded Provenance
banhxeo-0.1.3.tar.gz 198.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for banhxeo 0.1.3
File Interpreter ABI Platform
banhxeo-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 242.3 kB

Release files / banhxeo-0.1.3.tar.gz

Download URL banhxeo-0.1.3.tar.gz
Size 198.9 kB
Tags Source
SHA-256 checksum
How to use checksums
90265e4fb4078a8aa970b63868f21f82fb3bb2f4dae7cd11020e60e09e022660
BLAKE2b-256 checksum
How to use checksums
f06dc8f94c971dca63e00975b74b9286661fae5d7147745ae422006b921dd333
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.6

Release files / banhxeo-0.1.3-py3-none-any.whl

Download URL banhxeo-0.1.3-py3-none-any.whl
Size 43.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cb2c1998c417646b817429a37a6b1683d8391521f2169049c1bee73968a9d00
BLAKE2b-256 checksum
How to use checksums
48e39726b5309056615dfa9fc0cd711157e59d214cc83d135ae844e4767b7d7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.6

Security for banhxeo 0.1.3

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.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

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