Skip to content

Update stats.py#10

Open
alizare84 wants to merge 1 commit intopytopia:mainfrom
alizare84:main
Open

Update stats.py#10
alizare84 wants to merge 1 commit intopytopia:mainfrom
alizare84:main

Conversation

@alizare84
Copy link

better handling of odd character!

better handling of odd character!
# load chat data
logger.info(f"Loading chat data from {chat_json}")
with open(chat_json) as f:
with open(chat_json, encoding='UTF8') as f:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Ali and thanks for the PR.
Encoding of JSON files extracted from Telegram is UTF-8 and It is a good idea to identify the encoding of files when reading them. Thanks for this suggestion.

:param text: Text that contains emoji
"""
regrex_pattern = re.compile(pattern="[\u2069\u2066]+", flags=re.UNICODE)
regrex_pattern = re.compile(pattern="["
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since in the next line the demoji.replace(text, " ") is responsible for deleting all the emojis, we do not need to delete each emoji separately.

You can find the emojis that method demoji.replace() handles in the package document:
https://unicode.org/Public/emoji/14.0/emoji-sequences.txt

@siniorone
Copy link
Collaborator

siniorone commented Jan 30, 2022

It is better to make changes in a branch and then send PRs. alizare84:alizare84_encoding instead of alizare84:main in your personal forked repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants