A comprehensive, production-ready pipeline for processing, cleaning, and managing Pashto language datasets. This system combines advanced NLP techniques, web scraping, PDF processing, and dataset management capabilities specifically designed for the Pashto language.
- π€ Text Processing: Advanced Pashto text normalization, tokenization, and cleaning
- π Web Scraping: Multi-source data collection from Pashto websites and news sources
- π PDF Processing: Extract and process text from Pashto PDF documents
- π― Quality Control: Built-in quality assessment and deduplication
- π Dataset Management: Create, manage, and export Pashto datasets
- π Pipeline Orchestration: Flexible, configurable processing pipelines
- π Monitoring: Comprehensive logging and progress tracking
- Unicode Support: Full Unicode compatibility for Pashto script
- Character Normalization: Standardize Pashto character variations
- Digit Normalization: Convert between Western, Pashto, and Arabic numerals
- Diacritic Handling: Optional diacritic removal and standardization
- Tokenization: Context-aware Pashto word and sentence tokenization
- Stopwords: Built-in Pashto stopword lists
Pashto-Processing-pipeline/
βββ pashto_pipeline/ # Main package - Core processing modules
β βββ core/ # Pipeline orchestration
β βββ preprocessing/ # Text normalization and tokenization
β βββ utils/ # Utility functions
β
βββ code/pashto_dataset/ # Extended dataset processing system
β βββ pipeline/ # Advanced pipeline management
β βββ text_processor/ # Text processing modules
β βββ scrapers/ # Web scraping tools
β βββ pdf_processor/ # PDF extraction
β βββ dataset_manager/ # Dataset creation and management
β
βββ docs/ # Documentation
β βββ guides/ # User guides and tutorials
β βββ api/ # API documentation
β βββ troubleshooting/ # Common issues and FAQ
β
βββ examples/ # Example code and configurations
β βββ python/ # Python examples
β βββ config/ # Sample configurations
β βββ bash/ # Shell scripts
β
βββ tests/ # Test suite
β βββ unit/ # Unit tests
β βββ integration/ # Integration tests
β
βββ data/ # Data directories
β βββ raw/ # Raw input data
β βββ processed/ # Processed output data
β
βββ models/ # Trained models and resources
# Clone the repository
git clone https://github.com/tasal9/Pashto-Processing-pipeline.git
cd Pashto-Processing-pipeline
# Run the installation script
bash install.sh
# Activate the virtual environment
source venv/bin/activate# Clone the repository
git clone https://github.com/tasal9/Pashto-Processing-pipeline.git
cd Pashto-Processing-pipeline
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
pip install -e .from pashto_pipeline import PashtoNormalizer, PashtoTokenizer
# Initialize components
normalizer = PashtoNormalizer(
normalize_whitespace=True,
normalize_digits='western'
)
tokenizer = PashtoTokenizer(preserve_punctuation=True)
# Process text
text = "Ψ³ΩΨ§Ω
Ψ―ΩΫΨ§! Ψ―Ψ§ Ψ― ΩΎΪΨͺΩ Ω
ΨͺΩ ΩΎΨ±ΩΨ³Ψ³ Ϊ©ΩΩΩ ΫΩΩ Ψ³Ψ§Ψ―Ω Ψ¨ΫΩΪ«Ω Ψ―Ω."
normalized = normalizer.normalize(text)
tokens = tokenizer.tokenize(normalized)
print(f"Tokens: {tokens}")from pashto_pipeline import TextProcessingPipeline, PashtoNormalizer, PashtoTokenizer
# Create pipeline
pipeline = TextProcessingPipeline()
# Add processing steps
pipeline.add_step('normalize', PashtoNormalizer().normalize)
pipeline.add_step('tokenize', PashtoTokenizer().tokenize)
# Process text
result = pipeline.process("Ψ³ΩΨ§Ω
Ψ―ΩΫΨ§!", verbose=True)
print(result)
# Batch processing
texts = ["Ψ²Ω ΩΎΩ Ϊ©Ψ§Ψ¨Ω Ϊ©Ϋ Ψ§ΩΨ³ΫΪΩ
.", "ΩΎΪΨͺΩ ΫΩΩ ΪΪ©ΩΫ ΪΨ¨Ω Ψ―Ω."]
results = pipeline.process_batch(texts)from code.pashto_dataset.text_processor.text_normalizer import PashtoTextNormalizer
from code.pashto_dataset.text_processor.quality_filter import QualityFilter
# Initialize advanced components
normalizer = PashtoTextNormalizer()
quality_filter = QualityFilter()
# Process and filter text
text = "Ψ³ΩΨ§Ω
Ψ―ΩΫΨ§"
normalized = normalizer.normalize(text)
is_quality = quality_filter.is_high_quality(normalized)
print(f"Text quality: {'High' if is_quality else 'Low'}")- Installation Guide
- Configuration Guide
- Usage Tutorials
- Best Practices
- API Reference
- Troubleshooting
- FAQ
Check the examples/ directory for:
- Python Examples:
examples/python/ - Configuration Files:
examples/config/ - Shell Scripts:
examples/bash/
The pipeline is highly configurable. See examples/config/ for sample configuration files:
# example: basic_config.yaml
pipeline:
name: "pashto_processing"
version: "1.0"
processing:
normalize:
unicode_form: "NFC"
remove_diacritics: false
normalize_digits: "western"
tokenize:
preserve_punctuation: true
lowercase: false- TextProcessingPipeline: Main pipeline orchestrator
- PashtoNormalizer: Unicode and character normalization
- PashtoTokenizer: Word and sentence tokenization
- StopwordsRemover: Remove common Pashto stopwords
- Web Scrapers: Collect data from Pashto websites
- PDF Processor: Extract text from PDFs
- Quality Filter: Assess text quality
- Deduplicator: Remove duplicate content
- Dataset Manager: Create and manage datasets
Run the test suite:
# Run all tests
pytest
# Run with coverage
pytest --cov=pashto_pipeline --cov-report=html
# Run specific test file
pytest tests/unit/test_normalizer.py- Web Scraping: Pashto news sites, forums, and blogs
- PDF Documents: Books, articles, and reports
- Text Files: Plain text, CSV, JSON
- Databases: SQL and NoSQL databases
- APIs: Integration with external Pashto language APIs
- Pashto Dialects: Southern, Northern, and Western Pashto
- Script: Perso-Arabic script (Pashto variant)
- Encodings: UTF-8, UTF-16, legacy encodings
- Normalization: NFC, NFD, NFKC, NFKD forms
- Memory Efficient: Optimized for large datasets
- Batch Processing: Process multiple texts efficiently
- Progress Tracking: Real-time monitoring with tqdm
- Parallel Processing: Multi-threading support (where applicable)
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Pashto NLP Research Community
- Unicode Consortium for Pashto script support
- Contributors and maintainers
- Issues: GitHub Issues
- Documentation: See
docs/directory - Examples: See
examples/directory
- Add more Pashto-specific NLP tools
- Improve dialect detection
- Add part-of-speech tagging
- Support for speech-to-text integration
- Enhanced OCR for Pashto handwriting
- Cloud deployment guides
Made with β€οΈ for the Pashto language community