Closed KianKhadempour closed 1 year ago
@BlueishTint I agree that this needs some refactoring. The available formats of telegram exports are referenced in #26
@BlueishTint fyi I refactored the telegram parser just now.
I didn't see this until now but thanks! It looks much better.
I am currently adding typing to the files to make it easier to use chat-miner. While doing this I read (for the first time) the code for the Telegram parser. The
_read_raw_messages_from_file
method is really good (other than a potential spot for atqdm
) but the_parse_message
method is littered withassert
andisinstance
. In addition, I don't really understand what the code is doing.For reference, here is the current code:
I propose that someone who knows how the Telegram JSON file is structured tries to rewrite this method (perhaps @galatolofederico) so that it is more readable, type-safe (not actually but it makes it harder to make mistakes), and pythonic.