Skip to main content

Punjabi Shahmukhi NLP preprocessing toolkit

Project description

Punjabi NLP Toolkit 🇵🇰

A Python library for Punjabi (Shahmukhi + Roman) Natural Language Processing.

This toolkit is designed to handle real-world Punjabi text, including:

  • Mixed script input (Roman + Shahmukhi)
  • Noisy social media text
  • Linguistic normalization

🚀 Features

  • ✅ Unicode & character normalization
  • 🔄 Roman Punjabi → Shahmukhi conversion
  • ✂️ Sentence & word tokenization
  • 🚫 Stopword removal
  • 📊 Frequency analysis
  • 🔗 N-gram extraction (bigrams, trigrams)
  • 🔍 Script detection (Shahmukhi / Gurmukhi / Roman)

📦 Installation

pip install punjabi-nlp

⚡ Quick Start

from punjabi_nlp import PunjabiPipeline

pipeline = PunjabiPipeline()

text = "mnu lagda ae tussi theek o"

output = pipeline.process(text)

print(output)

🧪 Example Output

{
  'script': 'shahmukhi',
  'normalized_text': 'مینوں لگدا اے تسی ٹھیک او',
  'sentences': ['مینوں لگدا اے تسی ٹھیک او'],
  'tokens': ['مینوں', 'لگدا', 'اے', 'تسی', 'ٹھیک', 'او'],
  'token_count': 6,
  'frequency': {
    'مینوں': 1,
    'لگدا': 1,
    'اے': 1,
    'تسی': 1,
    'ٹھیک': 1,
    'او': 1
  }
}

🔥 Mixed Script Example (Real-World Input)

text = "کِتّھے ایں؟ mnu lagda ae tussi theek o"

Output:

کتھے ایں? مینوں لگدا اے تسی ٹھیک او

👉 This demonstrates:

  • Shahmukhi normalization
  • Roman conversion
  • Clean tokenization

🧠 Why This Library?

Punjabi is a low-resource language in NLP, especially in Shahmukhi script.

This toolkit aims to:

  • Provide a standard preprocessing pipeline
  • Support linguistic research
  • Enable corpus-based studies
  • Handle code-mixed Punjabi text

📊 Corpus Analysis

The library supports:

  • Word frequency
  • Bigrams & trigrams
  • Lexical pattern extraction

🏗️ Project Structure

punjabi_nlp/
├── normalization.py
├── tokenization.py
├── roman.py
├── stopwords.py
├── utils.py
├── corpus.py
└── pipeline.py

🧩 Example Use Cases

  • 📚 Corpus linguistics research
  • 🧠 NLP model preprocessing
  • 💬 Social media text cleaning
  • 🗣️ Punjabi language tools
  • 🎓 Teaching computational linguistics

⚠️ Limitations

  • Rule-based Roman conversion (not fully phonetic yet)
  • Limited stopword list
  • No POS tagging (planned)

🚀 Future Work

  • 🔁 Shahmukhi ↔ Gurmukhi transliteration
  • 🧠 Smart phonetic Roman conversion
  • 🏷️ POS tagging
  • 📈 Named Entity Recognition (NER)
  • 🖥️ GUI tool for live processing

🤝 Contributing

Contributions are welcome!

You can help by:

  • Improving normalization rules
  • Expanding Roman mappings
  • Adding datasets
  • Reporting issues

📜 License

MIT License


👤 Author

Shoaib Tahir Computational Linguistics | Punjabi NLP


⭐ Support

If you find this project useful:

  • ⭐ Star the repository
  • 📢 Share with others
  • 🧠 Use in research

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

punjabi_nlp_shahmukhi-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

punjabi_nlp_shahmukhi-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: punjabi_nlp_shahmukhi-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for punjabi_nlp_shahmukhi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fa300c512504dde3bb069a1b9b1ffc07d3d78c6c39953edf3e865aac10805d5f
MD5 c6e6c2c45da88d5b6eb45c41cdd0bb13
BLAKE2b-256 fcd32ef829897d50f48d7b7585eaf2ebd22bcfce9a592f4d4c6127b0e0e6eebe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for punjabi_nlp_shahmukhi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1aec9fe651b525a7168b33cd61a15c93457504a1b2152844e3e063c5ba84686
MD5 13a21f2dc890abf62cb90161ede91744
BLAKE2b-256 57b6f71d6f89a22b035082d9e3d3c8e576410be49d0bef719eee0b71f81d2235

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