TelegramBot Handcrafted for Translation of places in OpenStreetMap
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
config.yaml
export_db.py
input.csv.sample
populate_db.py
requirements.txt
translate_bot.py

README.md

OSM-Translate-TelegramBot

This bot it designed to help translation of OpenStreetMap location from English to any Regional Language.

Tech

OSM-Translate-TelegramBot uses various python packages / open source projects to work properly:

  • Pandas - pandas is an open source, library providing high-performance, easy-to-use data structures and data analysis tools for the Python.
  • SQLAlchemy - Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL.
  • pyTelegramBotAPI - A simple, but extensible Python implementation for the Telegram Bot API.
  • PyYAML - YAML parser and emitter for Python.
  • MySQL - Database being used.

Installation

Tested on python 3.*

$ git clone https://github.com/Dineshkarthik/OSM-Translate-TelegramBot.git
$ cd OSM-Translate-TelegramBot
$ pip install -r requirements.txt

Configuration

 token: 'YOUR_BOT_TOKEN'
 input_csv: '/PATH/TO/YOUR/INPUT/INPUT.CSV'
 db_name: 'NAME_FOR_DB_TO_BE_GENERATED'
 db_username: 'MYSQL_USER_NAME'
 db_password: 'MYSQL_PASSWORD'
 db_host: 'localhost'
 db_port: 3306
 export_type: 'batch'
 bot_admin: ['admin1_telegram_username', admin2_telegram_username']
  • token - Your Telegram Bot API Token, to get the token follow the instructions available here
  • input_csv - Path to the input csv file, which contains the Locations to be translated.
  • The Input csv file should consists of the following 3 mandatory columns
    • osm_id - OSM Node ID of the Location
    • name - Name of the Location to be translated
    • translation - Suggested Google or any other translation if available (But the column is mandatory)
  • db_name - Name of the MySQL db, will be generated if not exists.
  • db_username - User name to connect to MySQL database.
  • db_password - Password to connect to DB.
  • db_host - Hostname of the DB, if using local database use localhost
  • db_port - Port to connect to db, MySQL default port is 3306
  • export_type - For exporting data from DB
    • batch - To export data which is not exported already.
    • all - To export all available data which are wither verified or translated.
  • bot_admin - Telegram username of the user to be given Admin access.

Execution

$ python populated_db.py 
$ python translate_bot.py
$ python export_db.py
  • Running populated_db.py will generate a MySQL DB if not already created and will seed it with data from the input csv file and to update admin roles to existing users.
  • Run python -c 'from populate_db import add_admin; add_admin()'to update admin roles alone without importing data to DB.
  • Running translate_bot.py will start the Telegram Bot.
  • Runnign export_db.py will export translated data available in DB to a CSV file.