<jupyter_start><jupyter_text>fix formats (Adding underscore instead of spaces)<jupyter_code>import re
actors = [] 
with open('actor_dic_ar_v3.txt') as finput : 
        for i in finput  : 
            actors.append(i)
actors[:10]
x = '_'.join(re.findall(r'[\u0600-\u06FF]+', actors[2])) +'_'
x
for i in range(len(actors)) : 
    ar_exp = re.findall(r'[\u0600-\u06FF]+', actors[i])
    if not ar_exp or len(ar_exp)==1 :
        continue
    new_ar_exp = '_'.join(ar_exp) + '_'
#     print('ar_exp {}'.format(ar_exp))
#     print('new_ar_exp {}'.format(new_ar_exp))
    
#     print('before {} '.format(i))
    actors[i] = actors[i].replace(' '.join(ar_exp) , new_ar_exp)
#     print('after {} '.format(i))
    
    
    
actors[:10]
with open('actor_dict_ar_v4.txt', 'w') as output : 
    for i in actors:
        output.write(i)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18065268065268064, 'fraction_numerical': 0.023310023310023312, 'mean_word_length': 3.295, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '145733', 'license': 'MIT', 'n_tokens_mistral': 358, 'n_tokens_neox': 338, 'n_words': 61, 'path': 'scripts_and_code/scripts/fix_actors_and_lemmatize.ipynb', 'repo_name': 'openeventdata/arabic_dictionaries', 'size': '858'}