Skip to content

AI4Bharat/Indic-Swipe-v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🖊️ IndicSwipe v2

A state-of-the-art gesture typing (Swipe-to-Type) app tailored for Indian languages. IndicSwipe combines a deep character-level Transformer gesture decoder with n-gram language models running on-device for fast, accurate, and fluid typing across 22+ Indian languages and romanized dialects (Hinglish, Tanglish, etc.).

Get it on Google Play


📺 Overview & Demo

IndicSwipe Gesture Typing Demo


🌐 Supported Languages & Downloads

IndicSwipe supports 22 scheduled languages of India and their corresponding keyboard layouts, along with their romanized variants. You can download the pre-trained models and dataset packages directly from the table below:

Language Script / ISO Code Accent Color Transliteration Swipe Decoding
Hindi __hi__ / हिन्दी #FF6D00 📥 Download 📥 Download
Bengali __bn__ / বাংলা #283593 📥 Download 📥 Download
Tamil __ta__ / தமிழ் #FFD600 📥 Download 📥 Download
Telugu __te__ / తెలుగు #FF1744 📥 Download 📥 Download
Marathi __mr__ / मराठी #2979FF 📥 Download 📥 Download
Kannada __kn__ / ಕನ್ನಡ #AA00FF 📥 Download 📥 Download
Gujarati __gu__ / ગુજરાતી #AFB42B 📥 Download 📥 Download
Punjabi __pa__ / ਪੰਜਾਬੀ #F9A825 📥 Download 📥 Download
Malayalam __ml__ / മലയാളം #00BFA5 📥 Download 📥 Download
Odia __or__ / ଓଡ଼ିଆ #0277BD 📥 Download 📥 Download
Assamese __as__ / অসমীয়া #00897B 📥 Download 📥 Download
Maithili __mai__ / मैथिली #7E57C2 📥 Download 📥 Download
Sanskrit __sa__ / संस्कृतम् #FF5722 📥 Download 📥 Download
Urdu __ur__ / اردو #1B5E20 📥 Download 📥 Download
Kashmiri __ks__ / کٲشُر #43A047 📥 Download 📥 Download
Nepali __ne__ / नेपाली #C62828 📥 Download 📥 Download
Sindhi (Arabic) __sd__ / سنڌي #00BCD4 📥 Download 📥 Download
Sindhi (Devanagari) __sdd__ / सिंधी #008080 📥 Download 📥 Download
Konkani __gom__ / कोंकणी #EC407A 📥 Download 📥 Download
Manipuri __mni__ / ꯃꯩꯇꯩꯂꯣꯟ #880E4F 📥 Download 📥 Download
Bodo __brx__ / बड़ो #607D8B 📥 Download 📥 Download
Dogri __doi__ / डोगरी #795548 📥 Download 📥 Download
Santali __sat__ / ᱥᱟᱱᱛᱟᱲᱤ #2E7D32 📥 Download 📥 Download

🛠️ Model Training & Pipeline

The pipeline is split into modular scripts located in the training/ directory.

Step 1: Generate Gesture Datasets

Generate synthetic swipe trajectory datasets based on keyboard geometry and target lexicons.

python training/01_generate_dataset.py --lang marathi --output training/data/marathi_train.jsonl

Step 2: Train the Transformer Model

Train the CharacterLevelSwipeModel with standard trajectory features (normalized coordinates, velocity, acceleration, nearest key embeddings) and character tokenizer.

python training/02_train_model.py \
    --lang marathi \
    --train_path training/data/marathi_train.jsonl \
    --val_path training/data/marathi_val.jsonl \
    --checkpoint_dir checkpoints/marathi/

Step 3: Export PyTorch to ONNX

Compile the PyTorch model encoder and decoder to standard ONNX with dynamic shapes.

python training/03_export_onnx.py \
    --checkpoint checkpoints/marathi/best_model.pt \
    --out_dir android_ready/marathi/

Step 4: Graph Optimization

Perform ONNX constant folding, dead-node elimination, and sequence fusing.

python training/04_optimize_onnx.py \
    --model_dir android_ready/marathi/

Step 5: Post-Training Quantization

Quantize the weights to 8-bit integers (INT8) to reduce model size by 4x with negligible accuracy drop.

python training/05_quantize_onnx.py \
    --model_dir android_ready/marathi/

📱 Android App Integration

The Android Keyboard App located in indic_swipe_android_studio_bundle_1 features:

  • ONNX Runtime Mobile: Integrated local inference using ONNXRuntime to execute the gesture decoder.
  • KenLM JNI: Custom C++ bindings compiled using NDK (kenlm-jni) to perform blazing-fast N-Gram language model language scoring on the decoder's beam outputs.
  • Swipe Trail Renderer: Premium visual physics-based smooth finger trails (SwipeView.kt).

To run the Android App:

  1. Open the indic_swipe_android_studio_bundle_1 directory in Android Studio.
  2. Build the C++ JNI libraries using NDK CMake.
  3. Place your optimized models (swipe_model_character_quant.onnx and language files) in the app/src/main/assets directory.
  4. Build and run on an Android Device/Emulator!

👥 Contributors

  • Srihari S
  • Thanmay Jayakumar
  • Raj Dabre

🤝 Acknowledgements

We would like to express our gratitude to the following individuals for their support (listed in alphabetical order):

  • Deepon Halder
  • Kaushal Bhogale
  • Krishna Jeena
  • Mohammed Safi Ur Rahman Khan
  • Pranjal Chitale
  • Sidharth Pulipaka
  • Tahir Javed
  • Vignesh Selvaraj

📚 References

  1. IndicSwipe:
    • Paper: "Joint Transformer/RNN Architecture for Gesture Typing in Indic Languages" (COLING 2020)
    • Repository: AI4Bharat/Indic-Swipe
  2. Aksharantar:
  3. CleverKeys:
  4. Google Keyboard (Gboard) Gesture Typing:
  5. Google Keyboard Blog:

📝 License

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors