Skip to main content

A Natural Language Processing toolkit for the Nagamese language.

Project description

NagaNLP: Natural Language Processing for Nagamese

PyPI License: MIT Python Version Code style: black

A comprehensive Natural Language Processing toolkit for the Nagamese language, developed by Agniva Maiti (4th Year BTech, KIIT-DU, Bhubaneswar, Odisha).

Python Version License: MIT Code style: black

A comprehensive NLP toolkit for the Nagamese language, featuring state-of-the-art models for part-of-speech tagging and machine translation.

Features

  • Part-of-Speech Tagging: Fine-tuned BERT model for accurate POS tagging
  • Neural Machine Translation: Seq2Seq model for Nagamese to English translation
  • Subword Tokenization: Support for handling out-of-vocabulary words
  • Word Alignment: Tools for parallel corpus alignment
  • Easy Integration: Simple Python API for all functionalities

Installation

pip install naganlp

Quick Start

Part-of-Speech Tagging

Transformer-based Tagger (Recommended for production)

This uses a fine-tuned transformer model for high accuracy.

from naganlp import PosTagger

# Initialize the tagger (automatically downloads the model on first use)
tagger = PosTagger("agnivamaiti/naganlp-pos-tagger")  # Default model

# Tag a Nagamese sentence
result = tagger.tag("moi school te jai")
print(result)
# Output: [{'entity_group': 'PRON', 'word': 'moi', ...}]

NLTK-based Tagger (Lightweight, faster but less accurate)

This is a good option for development or when resources are limited.

from naganlp import NltkPosTagger

# First train and save the model (only needed once)
from naganlp.nltk_tagger import train_and_save_nltk_tagger
train_and_save_nltk_tagger("path/to/your/conll/file.conll", "naga_pos_model.pkl")

# Then load and use the trained model
tagger = NltkPosTagger("naga_pos_model.pkl")

# Tag a list of pre-tokenized words
result = tagger.predict(["moi", "school", "te", "jai"])
print(result)
# Output: [('moi', 'PRON'), ('school', 'NOUN'), ('te', 'ADP'), ('jai', 'VERB')]

Translation

from naganlp import Translator

# Initialize the translator
translator = Translator()

# Translate from Nagamese to English
translation = translator.translate("moi school te jai")
print(translation)
# Output: "I go to school"

Documentation

Data Requirements

  • For POS Tagging: CONLL-formatted file with token and POS tag columns
  • For Translation: Parallel corpus in CSV format with 'nagamese' and 'english' columns

Model Training

POS Tagger Training

python main.py train-tagger --conll-file path/to/train.conll --hub-id your-username/naganlp-pos-tagger

NMT Model Training

python main.py train-translator --data-file path/to/parallel_corpus.csv --hub-id your-username/naganlp-nmt

Advanced Usage

Custom Model Paths

# Load custom models
custom_tagger = PosTagger(model_name_or_path="path/to/custom/model")
custom_translator = Translator(model_path="path/to/translator.pt", vocabs_path="path/to/vocabs.pkl")

Contributing

Contributions are welcome! Please read our Contributing Guidelines for details.

Contributing

Contributions are welcome! Please read our Contributing Guidelines and Code of Conduct for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

Acknowledgments

  • KIIT University for the support and resources
  • All contributors and users of this library

Citation

If you use NagaNLP in your research, please cite:

@software{naganlp2023,
  title={NagaNLP: Natural Language Processing Toolkit for Nagamese},
  author={Your Name},
  year={2023},
  publisher={GitHub},
  journal={GitHub repository},
  howpublished={\url{https://github.com/your-username/naga-nlp}}
}

Support

For questions and support, please open an issue on our GitHub repository.

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

naganlp-0.1.0.tar.gz (506.7 kB view details)

Uploaded Source

Built Distribution

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

naganlp-0.1.0-py3-none-any.whl (169.2 kB view details)

Uploaded Python 3

File details

Details for the file naganlp-0.1.0.tar.gz.

File metadata

  • Download URL: naganlp-0.1.0.tar.gz
  • Upload date:
  • Size: 506.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for naganlp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4603145ca04c96257756b4311cc86c863c2ac1c8690d75a72fe553ef31938014
MD5 d5095746688b7eb7a3260ae781a87e5f
BLAKE2b-256 61559526384419d5294636affd0237f80957289a3d4f22215c6692d2a5da407e

See more details on using hashes here.

File details

Details for the file naganlp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: naganlp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 169.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for naganlp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e84e0e7e442f16fd5d9e4493e10b247c076457a152fd25709f7fdcc969de4497
MD5 aabd4196ac90e8bde13b7dd79bead285
BLAKE2b-256 bb7fea097dc87967e86e85d990d7c7a1f71f895851a9e1c5ca0baad85461f96e

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