Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
543 B
4
Indexable
Never
import json
from collections import Counter
from hazm import word_tokenize, Normalizer
from wordcloud import WordCloud

import arabic_reshaper
from bidi.algorithm import get_display

with open ('../data/group.json') as f :
    data = json.load(f)

text_content = '' 

for msg in data['messages']:
    if type(msg['text']) is str:
        text_content += f" {msg['text']}"

normalizer = Normalizer()
text_content = normalizer.normalize(text_content)

text_content = arabic_reshaper.reshape(text_content)
text_content = get_display(text_content)