Skip to content

RavMda/latinica

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latinica 🌐🔠

Real-time Cyrillic-to-Latin transliteration bot for Discord and Telegram

License

Features ✨

  • 🔄 Automatic transliteration of Cyrillic characters
  • 📊 Cyrillic content detection with percentage analysis
  • 🤖 Multi-platform support:
    • Discord message responses
    • Telegram inline queries
  • 🎯 Custom transliteration rules
  • ⚡ Discord and Telegram clients run concurrently

Installation 🛠️

  1. Clone the repository:
git clone https://github.com/yourusername/latinica.git
cd latinica
  1. Create .env file:
DISCORD_TOKEN=your_discord_bot_token
TELEGRAM_TOKEN=your_telegram_bot_token
  1. Build and run:
cargo run

Usage 🚀

Discord

  1. Invite your bot to a server
  2. Send any message containing Cyrillic text
  3. Bot will respond with transliterated text

Telegram

  1. Open any chat
  2. Type @your_bot_username your_query
  3. Select transliterated text from inline results

Transliteration Rules 📖

Uses custom mappings designed for phonetic transliteration of Cyrillic characters:

  • Supports all Russian Cyrillic letters (а-я, А-Я) including ё and Ё
  • Special multi-character mappings (e.g., "ща" → "šia", "ЩА" → "ŠIA")
  • Case-sensitive replacements (e.g., "Ж" → "Ž", "ж" → "ž")
  • Fallback preserves original characters with no mapping (e.g., punctuation)
  • Context-aware handling for letter combinations like "щ" in different positions

See transliterate/mod.rs for full character mapping definitions.

Running the Bot 🏃♂️

cargo run

Testing 🧪

cargo test
# Includes:
# - Cyrillic detection tests
# - Transliteration accuracy tests
# - Edge case handling

Contributing 🤝

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

About

Cyrillic-to-Latin transliteration bot for Discord and Telegram

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages