JRavi2 / Chat-Analyzer

A python program to analyze your Social Chats
12 stars 8 forks source link

Add Tests for Telegram Chat Exports #3

Open JRavi2 opened 2 years ago

JRavi2 commented 2 years ago

Currently, there are tests for Signal and WhatsApp. Similarly, tests for Telegram Exports are to be added.

asaraf7 commented 2 years ago

In which format should I provide the Telegram test data : Text file or JSON?

JRavi2 commented 2 years ago

@asaraf7 JSON would be fine. Should I assign this issue to you, if you'd like to work on it?

asaraf7 commented 2 years ago

I have an idea. I'll create 5 Telegram bots and add them in a group. Then I'll send say 10000 Test Messages using python requests module. Shall I proceed with this?

JRavi2 commented 2 years ago

The problem with this approach would be that the results generated through this would be too unnatural, and wouldn't represent a real-world scenario (even if you sent the messages randomly).

My recommendation would be to get a chat export from an actual telegram group with a sufficient number of messages. Also, you could write a simple script to replace usernames with A, B, C, D... and redact the messages.

asaraf7 commented 2 years ago

I'm writing a script as suggested by you. But for that I'll have to open and decode the original json. It raises an exception while reading emojis. How to handle that?

JRavi2 commented 2 years ago

@asaraf7 Could you share the error message?

I think the exception might be due to the encoding. Try passing encoding='utf-8' parameter to the open function.

asaraf7 commented 2 years ago

@asaraf7 Could you share the error message?

I think the exception might be due to the encoding. Try passing encoding='utf-8' parameter to the open function.

Implemented and PR has been sent!