Skip to content

Latest commit

 

History

History
70 lines (53 loc) · 1.96 KB

File metadata and controls

70 lines (53 loc) · 1.96 KB

News Telegram Bot

A simple Telegram bot for news aggregation, filtering, and neutralization from various sources.

Features

  • Multi-language support (English, Russian)
  • News aggregation from multiple sources (RBC and others)
  • News categorization (Economy, Politics, Society, etc.)
  • Category-based news filtering
  • Telegram interface
  • Real-time news notifications
  • News neutralization:
    • Bias removal
    • Emotional coloring reduction
    • Fact-focused presentation

Project Structure

bot/
├── locales/           # Localization files
│   ├── en.json       # English translations
│   └── ru.json       # Russian translations
├── rss/              # RSS parsers
│   ├── abstract.py   # Abstract RSS parser class
│   └── rbc.py        # RBC parser implementation
├── lm/               # Language models
├── controller.py     # Bot controller
├── service.py        # Business logic
├── repository.py     # Database operations
├── model.py          # Data models
├── strings.py        # String constants
└── database.py       # Database configuration

Project Components

Language Models (lm/)

  • make_neutral.py - Transforms news text to neutral tone
  • classify_news.py - Categorizes news articles

Installation and Deployment

  1. Move bot/.env.example to .env and set the environment variables:

  2. Run the docker compose:

docker-compose -f bot/docker-compose.yaml up -d

Localization

The bot supports multiple languages through JSON-based localization files located in the locales/ directory.

To add a new language:

  1. Create <language-code>.json in locales/
  2. Copy the structure from an existing language file
  3. Translate all strings

Adding News Sources

To implement a new news source:

  1. Create a new class in rss/
  2. Inherit from AbstractRSSParser
  3. Implement required methods
  4. Add the source to strings.py
  5. Update localization files