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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file punjabi_nlp_shahmukhi-0.1.1.tar.gz.
File metadata
- Download URL: punjabi_nlp_shahmukhi-0.1.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7ac75cf65a447db1fd432adce08b9d4852e75cc38fd7effef4d9313a3eed4f6
|
|
| MD5 |
af00f7e9d4b0e60785eb30e04caf1c02
|
|
| BLAKE2b-256 |
cdbe9cdc971f342a2c19b53e159da2ac852ad279d9a81fac5cf0fd5fdfafd720
|
File details
Details for the file punjabi_nlp_shahmukhi-0.1.1-py3-none-any.whl.
File metadata
- Download URL: punjabi_nlp_shahmukhi-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc70711169acece1edc668f0824c7d0b8621dc49a7ed3322950ede65a52f6bc5
|
|
| MD5 |
e78188071f615284a206fd28cff3e51f
|
|
| BLAKE2b-256 |
971955dcdf72ca43aa0b5ff5adff9b1d92c8923572b4cb70b7cae4e4cdbf9234
|