Skip to content

Commit

Permalink
Misc: Update translations
Browse files Browse the repository at this point in the history
  • Loading branch information
BLKSerene committed Jun 27, 2024
1 parent b61fcc1 commit b8db92e
Show file tree
Hide file tree
Showing 53 changed files with 18,840 additions and 17,569 deletions.
Binary file removed data/unifont-15.1.02.otf
Binary file not shown.
Binary file added data/unifont-15.1.05.otf
Binary file not shown.
4 changes: 2 additions & 2 deletions doc/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -946,8 +946,8 @@ The following variables would be used in formulas:<br>
<!--
Al-Heeti's Readability Prediction Formula:
\begin{align*}
\text{RD}_\text{Policy one} &= 4.41434307 \times \frac{\text{NumCharsAlpha}}{\text{NumWords}} - 13.46873475 \\
\text{RD}_\text{Policy two} &= 0.97569509 \times \frac{\text{NumCharsAlpha}}{\text{NumWords}} + 0.37237998 \times \frac{\text{NumWords}}{\text{NumSentences}} - 0.90451827 \times \frac{\text{NumWords}}{\text{NumWordTypes}} - 1.06000414
\text{RD}_\text{Policy One} &= 4.41434307 \times \frac{\text{NumCharsAlpha}}{\text{NumWords}} - 13.46873475 \\
\text{RD}_\text{Policy Two} &= 0.97569509 \times \frac{\text{NumCharsAlpha}}{\text{NumWords}} + 0.37237998 \times \frac{\text{NumWords}}{\text{NumSentences}} - 0.90451827 \times \frac{\text{NumWords}}{\text{NumWordTypes}} - 1.06000414
\end{align*}
Automated Arabic Readability Index:
Expand Down
347 changes: 174 additions & 173 deletions doc/measures/readability/rd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 0 additions & 6 deletions tests/test_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ def update_gui(err_msg, texts_stats_files):

assert len_sentences_total == numpy.sum(stats[3])

# Sentence length should never be zero
assert 0 not in count_sentences_lens

# Count of n-token-long Sentence Segments
if any(count_sentence_segs_lens):
count_sentence_segs_lens_files = wl_misc.merge_dicts(count_sentence_segs_lens)
Expand All @@ -195,9 +192,6 @@ def update_gui(err_msg, texts_stats_files):

assert len_sentence_segs_total == numpy.sum(stats[3])

# Sentence segment length should never be zero
assert 0 not in count_sentence_segs_lens

# Count of n-syllable-long Tokens
if len_tokens_syls is not None:
count_tokens_lens_files = wl_misc.merge_dicts(count_tokens_lens_syls)
Expand Down
4 changes: 2 additions & 2 deletions tests/tests_measures/test_measures_readability.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@

def test_rd():
rd_ara_0 = wl_measures_readability.rd(main, test_text_ara_0)
settings['rd']['variant'] = 'Policy one'
settings['rd']['variant'] = 'Policy One'
rd_ara_12_policy_1 = wl_measures_readability.rd(main, test_text_ara_12)
settings['rd']['variant'] = 'Policy two'
settings['rd']['variant'] = 'Policy Two'
rd_ara_12_policy_2 = wl_measures_readability.rd(main, test_text_ara_12)
rd_eng_12 = wl_measures_readability.rd(main, test_text_eng_12)

Expand Down
19 changes: 17 additions & 2 deletions tests/tests_nlp/test_texts.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
wl_token = wl_texts.Wl_Token('test', tag = '_NN')
wl_tokens = [wl_texts.Wl_Token('test', tag = '_NN')]

def test_check_text():
assert wl_texts.check_text('test') == 'test'
assert wl_texts.check_text(None) == ''

def test_check_texts():
assert wl_texts.check_texts(['test', None]) == ['test', '']

def test_wl_token():
wl_token = wl_texts.Wl_Token('test')
hash(wl_token)
Expand All @@ -35,7 +42,7 @@ def test_wl_token():
wl_token.update_properties(wl_token)

def test_to_tokens():
assert wl_texts.to_tokens(['test_NN']) == wl_tokens
assert wl_texts.to_display_texts(wl_texts.to_tokens(['test', None], tags = ['_NN', None])) == ['test_NN', '']

def test_display_texts_to_tokens():
assert wl_texts.display_texts_to_tokens(main, ['test_NN'])[0].display_text() == 'test_NN'
Expand Down Expand Up @@ -68,13 +75,18 @@ def test_to_display_texts():

def test_set_token_text():
assert wl_texts.set_token_text(wl_token, 'tests').display_text() == 'tests_NN'
assert wl_texts.set_token_text(wl_token, None).display_text() == '_NN'

def test_set_token_texts():
wl_tokens_copy = copy.deepcopy(wl_tokens)
wl_texts.set_token_texts(wl_tokens_copy, ['test1'])

wl_texts.set_token_texts(wl_tokens_copy, ['test1'])
assert wl_texts.to_display_texts(wl_tokens_copy) == ['test1_NN']

# If the token property is None, the token text should be set to empty
wl_texts.set_token_texts(wl_tokens_copy, [None])
assert wl_texts.to_display_texts(wl_tokens_copy) == ['_NN']

def test_has_token_properties():
assert wl_texts.has_token_properties(wl_tokens, 'tag')
assert not wl_texts.has_token_properties(wl_tokens, 'lemma')
Expand Down Expand Up @@ -112,6 +124,9 @@ def test_wl_text_total():
assert text_total_2.tagged

if __name__ == '__main__':
test_check_text()
test_check_texts()

test_wl_token()
test_to_tokens()
test_display_texts_to_tokens()
Expand Down
4 changes: 2 additions & 2 deletions tests/tests_results/test_results_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_wl_dialog_results_sort_concordancer():
main.settings_custom['concordancer']['sort_results']['sorting_rules'] = [
['Node', 'Ascending'],
['Sentiment', 'Ascending'],
['Token no.', 'Ascending'],
['Token No.', 'Ascending'],
['File', 'Ascending'],
['R1', 'Ascending'],
['L1', 'Ascending']
Expand All @@ -45,7 +45,7 @@ def test_wl_dialog_results_sort_concordancer():
dialog_results_sort_concordancer.update_gui([])

def test_table_results_sort_concordancer():
table_results_sort_concordancer = wl_results_sort.Table_Results_Sort_Conordancer(
table_results_sort_concordancer = wl_results_sort.Wl_Table_Results_Sort_Conordancer(
main,
table = table
)
Expand Down
1 change: 0 additions & 1 deletion tests/tests_settings/test_settings_lemmatization.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def test_wl_settings_lemmatization():
settings_lemmatization.apply_settings()

settings_lemmatization.preview_changed()
settings_lemmatization.preview_results_changed()
settings_lemmatization.update_gui('test')
settings_lemmatization.update_gui_err()

Expand Down
1 change: 0 additions & 1 deletion tests/tests_settings/test_settings_pos_tagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def test_wl_settings_pos_tagging():
settings_pos_tagging.apply_settings()

settings_pos_tagging.preview_changed()
settings_pos_tagging.preview_results_changed()
settings_pos_tagging.update_gui('test')
settings_pos_tagging.update_gui_err()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def test_wl_settings_sentence_tokenization():
settings_sentence_tokenization.apply_settings()

settings_sentence_tokenization.preview_changed()
settings_sentence_tokenization.preview_results_changed()
settings_sentence_tokenization.update_gui('test')
settings_sentence_tokenization.update_gui_err()

Expand Down
1 change: 0 additions & 1 deletion tests/tests_settings/test_settings_sentiment_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def test_wl_settings_sentiment_analysis():
settings_sentiment_analysis.apply_settings()

settings_sentiment_analysis.preview_changed()
settings_sentiment_analysis.preview_results_changed()
settings_sentiment_analysis.update_gui('test')
settings_sentiment_analysis.update_gui_err()

Expand Down
1 change: 0 additions & 1 deletion tests/tests_settings/test_settings_syl_tokenization.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def test_wl_settings_syl_tokenization():
settings_syl_tokenization.apply_settings()

settings_syl_tokenization.preview_changed()
settings_syl_tokenization.preview_results_changed()
settings_syl_tokenization.update_gui('test')
settings_syl_tokenization.update_gui_err()

Expand Down
1 change: 0 additions & 1 deletion tests/tests_settings/test_settings_word_tokenization.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def test_wl_settings_word_tokenization():
settings_word_tokenization.apply_settings()

settings_word_tokenization.preview_changed()
settings_word_tokenization.preview_results_changed()
settings_word_tokenization.update_gui('test')
settings_word_tokenization.update_gui_err()

Expand Down
2 changes: 1 addition & 1 deletion tests/tests_utils/test_threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_wl_thread_no_progress():
worker = wl_threading.Wl_Worker_No_Progress(main, lambda: None)
worker.run = lambda: None

wl_threading.Wl_Thread_No_Progress(worker).start_worker()
wl_threading.Wl_Thread_No_Progress(worker)

if __name__ == '__main__':
test_wl_worker()
Expand Down
22 changes: 16 additions & 6 deletions tests/wl_test_file_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ def wl_test_file_area(main):
def open_file(err_msg, files_to_open):
assert not err_msg

if files_to_open[-1]['name'] == '[amh] No language support':
files_to_open[-1]['lang'] = files_to_open[-1]['lang'] = 'amh'

if files_to_open[-1]['name'] == '[eng_gb] Tagged':
files_to_open[-1]['tagged'] = files_to_open[-1]['tagged'] = True

wl_file_area.Wl_Worker_Open_Files(
main,
dialog_progress = wl_dialogs_misc.Wl_Dialog_Progress(main, text = ''),
Expand All @@ -48,6 +54,12 @@ def open_file(err_msg, files_to_open):
def open_file_ref(err_msg, files_to_open):
assert not err_msg

if files_to_open[-1]['name'] == '[amh] No language support':
files_to_open[-1]['lang'] = files_to_open[-1]['lang'] = 'amh'

if files_to_open[-1]['name'] == '[eng_gb] Tagged':
files_to_open[-1]['tagged'] = files_to_open[-1]['tagged'] = True

wl_file_area.Wl_Worker_Open_Files(
main,
dialog_progress = wl_dialogs_misc.Wl_Dialog_Progress(main, text = ''),
Expand Down Expand Up @@ -124,18 +136,16 @@ def update_gui_ref(err_msg, new_files):
assert new_file['encoding'] == 'ascii'

if new_file['name'] == '[amh] No language support':
assert new_file['lang'] == 'other'
assert new_file['lang'] == 'amh'
else:
assert new_file['lang'] == 'eng_us'

assert not new_file['tokenized']
assert not new_file['tagged']

if new_file['name'] == '[amh] No language support':
new_file['lang'] = new_file['text'].lang = 'amh'

if new_file['name'] == '[eng_gb] Tagged':
new_file['tagged'] = new_file['text'].tagged = True
assert new_file['tagged']
else:
assert not new_file['tagged']

print(f'done! (In {round(time.time() - time_start, 2)} seconds)')

Expand Down
8 changes: 4 additions & 4 deletions tests/wl_test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def __init__(self, switch_lang_utils = 'default'):
self.email = '[email protected]'
self.email_html = '<a href="mailto:[email protected]">[email protected]</a>'

# Default settings
# Global and default settings
self.settings_global = wl_settings_global.init_settings_global()
self.settings_default = wl_settings_default.init_settings_default(self)

# Custom settings
Expand All @@ -76,9 +77,6 @@ def __init__(self, switch_lang_utils = 'default'):
else:
self.settings_custom = copy.deepcopy(self.settings_default)

# Global settings
self.settings_global = wl_settings_global.SETTINGS_GLOBAL

match switch_lang_utils:
case 'fast':
self.switch_lang_utils_fast()
Expand Down Expand Up @@ -234,6 +232,8 @@ def __init__(self, parent, tab = ''):

self.tab = tab
self.header_orientation = 'hor'

self.settings_global = wl_settings_global.init_settings_global()
self.settings = wl_settings_default.init_settings_default(self)

self.setModel(QStandardItemModel())
Expand Down
Loading

0 comments on commit b8db92e

Please sign in to comment.