Git Product home page Git Product logo

telegramcharfrequency's Introduction

Telegram Char Frequency Analyzer

A helper tool that analyzes char frequency in Telegram chat history exported as JSON.

Motivation

Char frequency analysis is typically used when developing new keyboard layouts for programmable keyboards, e.g., based on QMK. Since a lot of mechanical keyboards, especially ergonomic keyboards like ZSA Moonlander Mark I or Ergodox EZ, have much fewer keys than a standard keyboard, some less-used keycodes are put into layers. That's where char frequency analysis comes into play.

Since existing frequency statistic is based on language corpuses, like the Corpus of Contemporary American English (COCA), the texts are quite different from how we typically use our keyboards in online messengers or email. For example, using ')' might be much more frequent in online messengers than using '-' or even '.' because of typing emoji codes.

Exporting Data From Telegram

The official guide: Chat Export Tool. You can export the whole history or just the history for a particular chat.

When exporting, please select Machine-readable JSON in the Location and format section.

Usage

Usage: telegramcharfrequency [options] <inputFile>

A console tool to count characters frequency in Telegram chat history exported as JSON

Arguments:
  inputFile                         Telegram history exported as a JSON file

Options:
  -V, --version                     output the version number
  -u, --user <user-id>              Telegram User ID (you can use userinfobot to get it)
  --skip-emojis                     Skips emojis when counting frequencies
  -c, --categories [categories...]  Specific character categories to count (see https://unicode.org/reports/tr18/#General_Category_Property for more details)
                                    (choices: "Letter", "Mark", "Number", "Symbol", "Punctuation", "Separator", "Other")
  --include-code-points             Includes Unicode code points into the output to better distinguish similar characters
  -h, --help                        display help for command

An example:

telegramcharfrequency "C:\Users\myuser\Downloads\Telegram Desktop\DataExport_2023-07-23\result.json -u user123456789 --skip-emojis --include-code-points -c Symbol Punctuation

Implementation Details

The implementation uses stream-json to parse and process huge JSON files without excessive memory consumption since typical Telegram history can reach hundreds of megabytes.

telegramcharfrequency's People

Contributors

dropsonic avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.