File size: 3,490 Bytes
be07084 f854bc7 be07084 f854bc7 be07084 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | # Vedika - Sanskrit NLP Toolkit
Vedika is a comprehensive toolkit for Sanskrit text processing, offering deep learning-based tools for sandhi splitting and joining, text normalization, sentence splitting, syllabification, and tokenization.
## Features
- **Sandhi Processing**
- Split compound Sanskrit words using attention-based neural networks
- Join Sanskrit words with proper sandhi rules
- Support for beam search to get multiple suggestions
- **Text Processing**
- Syllabification
- Tokenization
- Sentence splitting
- Text normalization
## Installation
```bash
# Install from PyPI (Soon Coming)
pip install vedika
# Install from source
git clone https://github.com/tanuj437/vedika.git
cd vedika
pip install -e .
```
## Requirements
- Python >= 3.8
- PyTorch >= 1.9.0
- NumPy >= 1.19.0
- Pandas >= 1.3.0
- tqdm >= 4.62.0
- regex >= 2021.8.3
## Quick Start
### Sandhi Splitting
```python
from vedika import SanskritSplit
# Initialize splitter
splitter = SanskritSplit()
# Split a single word
result = splitter.split("रामायणम्")
print(result['split']) # Output: राम + अयन + अम्
# Batch processing
words = ["रामायणम्", "गीतागोविन्दम्"]
results = splitter.split_batch(words)
for result in results:
print(f"{result['input']} → {result['split']}")
```
### Sandhi Joining
```python
from vedika import SandhiJoiner
# Initialize joiner
joiner = SandhiJoiner()
# Join split words
result = joiner.join("राम+अस्ति")
print(result) # Output: रामास्ति
# Batch processing
texts = ["राम+अस्ति", "गच्छ+अमि"]
results = joiner.join_batch(texts)
print(results) # ['रामास्ति', 'गच्छामि']
```
## Advanced Usage
### Beam Search for Multiple Suggestions
```python
# Get multiple suggestions with beam search
result = splitter.split("रामायणम्", beam_size=3)
print(f"Best split: {result['split']}")
print(f"Confidence: {result['confidence']}")
print("Alternatives:")
for alt in result['alternatives']:
print(f"- {alt['split']} (confidence: {alt['confidence']})")
```
### Model Information
```python
# Get model details
info = splitter.get_model_info()
print(f"Vocabulary size: {info['vocabulary_size']}")
print(f"Device: {info['device']}")
print(f"Configuration: {info['model_config']}")
```
## Project Structure
```
vedika/
├── __init__.py
├── normalizer.py
├── sandhi_join.py
├── sandhi_split.py
├── sentence_splitter.py
├── syllabification.py
├── tokenizer.py
└── data/
├── cleaned_metres.json
├── sandhi_joiner.pth
└── sandhi_split.pth
```
## Model Architecture
The sandhi processing models use:
- Bidirectional LSTM encoder
- GRU decoder with attention
- Multi-head attention mechanism
- Character-level processing
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Authors
- Tanuj Saxena
- Soumya Sharma
## Citation
If you use Vedika in your research, please cite:
```bibtex
@software{vedika2025,
title={Vedika: A Sanskrit Text Processing Toolkit},
author={Saxena, Tanuj and Sharma, Soumya},
year={2025},
url={https://github.com/tanuj437/vedika}
}
```
## Contact
- Email: tanuj.saxena.rks@gmail.com, soumyasharma1599@gmail.com |