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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 4,
|
| 6 |
+
"id": "5cbc726d-b9ed-4a87-8424-780a4db25a36",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [],
|
| 9 |
+
"source": [
|
| 10 |
+
"import json\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"from pathlib import Path\n",
|
| 13 |
+
"from tabulate import tabulate"
|
| 14 |
+
]
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"cell_type": "code",
|
| 18 |
+
"execution_count": 20,
|
| 19 |
+
"id": "dbffdf82-5cb2-485d-9334-6e6fb8cc9c91",
|
| 20 |
+
"metadata": {},
|
| 21 |
+
"outputs": [
|
| 22 |
+
{
|
| 23 |
+
"name": "stdout",
|
| 24 |
+
"output_type": "stream",
|
| 25 |
+
"text": [
|
| 26 |
+
"{'dbmdz/convbert-base-turkish-cased': 'results-dbmdz-convbert-base-turkish-cased.jsonl', 'dbmdz/electra-base-turkish-mc4-cased-generator': 'results-dbmdz-electra-base-turkish-mc4-cased-generator.jsonl', 'dbmdz/distilbert-base-turkish-cased': 'results-dbmdz-distilbert-base-turkish-cased.jsonl', 'dbmdz/convbert-base-turkish-mc4-uncased': 'results-dbmdz-convbert-base-turkish-mc4-uncased.jsonl', 'dbmdz/bert-base-turkish-cased': 'results-dbmdz-bert-base-turkish-cased.jsonl', 'dbmdz/bert-base-turkish-128k-cased': 'results-dbmdz-bert-base-turkish-128k-cased.jsonl', 'dbmdz/electra-base-turkish-cased-generator': 'results-dbmdz-electra-base-turkish-cased-generator.jsonl', 'dbmdz/electra-base-turkish-mc4-uncased-generator': 'results-dbmdz-electra-base-turkish-mc4-uncased-generator.jsonl', 'dbmdz/convbert-base-turkish-mc4-cased': 'results-dbmdz-convbert-base-turkish-mc4-cased.jsonl', 'dbmdz/bert-base-turkish-128k-uncased': 'results-dbmdz-bert-base-turkish-128k-uncased.jsonl', 'dbmdz/electra-small-turkish-cased-generator': 'results-dbmdz-electra-small-turkish-cased-generator.jsonl', 'dbmdz/bert-base-turkish-uncased': 'results-dbmdz-bert-base-turkish-uncased.jsonl'}\n"
|
| 27 |
+
]
|
| 28 |
+
}
|
| 29 |
+
],
|
| 30 |
+
"source": [
|
| 31 |
+
"model_names = [\n",
|
| 32 |
+
" \"dbmdz/electra-small-turkish-cased-generator\",\n",
|
| 33 |
+
" \"dbmdz/electra-base-turkish-cased-generator\",\n",
|
| 34 |
+
" \"dbmdz/electra-base-turkish-mc4-cased-generator\",\n",
|
| 35 |
+
" \"dbmdz/electra-base-turkish-mc4-uncased-generator\",\n",
|
| 36 |
+
" \"dbmdz/bert-base-turkish-cased\",\n",
|
| 37 |
+
" \"dbmdz/bert-base-turkish-uncased\",\n",
|
| 38 |
+
" \"dbmdz/bert-base-turkish-128k-cased\",\n",
|
| 39 |
+
" \"dbmdz/bert-base-turkish-128k-uncased\",\n",
|
| 40 |
+
" \"dbmdz/distilbert-base-turkish-cased\",\n",
|
| 41 |
+
" \"dbmdz/convbert-base-turkish-cased\",\n",
|
| 42 |
+
" \"dbmdz/convbert-base-turkish-mc4-cased\",\n",
|
| 43 |
+
" \"dbmdz/convbert-base-turkish-mc4-uncased\",\n",
|
| 44 |
+
"]\n",
|
| 45 |
+
"\n",
|
| 46 |
+
"evaluation_files = [str(file) for file in Path(\"./\").iterdir() if file.name.endswith(\".jsonl\")]\n",
|
| 47 |
+
"\n",
|
| 48 |
+
"# \"dbmdz/electra-base-turkish-cased-generator\" -> \"results-dbmdz-electra-base-turkish-cased-generator.jsonl\"\n",
|
| 49 |
+
"model_name_evaluation_filename_mapping = {}\n",
|
| 50 |
+
"\n",
|
| 51 |
+
"for evaluation_file in evaluation_files:\n",
|
| 52 |
+
" reconstructed_model_name = evaluation_file.replace(\"results-\", \"\").replace(\".jsonl\", \"\")\n",
|
| 53 |
+
" reconstructed_model_name = reconstructed_model_name.replace(\"dbmdz-\", \"dbmdz/\")\n",
|
| 54 |
+
"\n",
|
| 55 |
+
" model_name_evaluation_filename_mapping[reconstructed_model_name] = evaluation_file\n",
|
| 56 |
+
"print(model_name_evaluation_filename_mapping)"
|
| 57 |
+
]
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"cell_type": "code",
|
| 61 |
+
"execution_count": 14,
|
| 62 |
+
"id": "7170ec01-f0f1-49bb-9beb-7927c3b5b3f7",
|
| 63 |
+
"metadata": {},
|
| 64 |
+
"outputs": [
|
| 65 |
+
{
|
| 66 |
+
"name": "stdout",
|
| 67 |
+
"output_type": "stream",
|
| 68 |
+
"text": [
|
| 69 |
+
"{'data/base/augmented_anaphor_agreement.csv': 'Anaphor Agreement', 'data/base/augmented_argument_structure_transitive.csv': 'Argument Str. Tran.', 'data/base/augmented_argument_structure_ditransitive.csv': 'Argument Str. Ditr.', 'data/base/augmented_binding.csv': 'Binding', 'data/base/augmented_determiners.csv': 'Determiners', 'data/base/augmented_ellipsis.csv': 'Ellipsis', 'data/base/augmented_irregular_forms.csv': 'Irregular Forms', 'data/base/augmented_island_effects.csv': 'Island Effects', 'data/base/augmented_nominalization.csv': 'Nominalization', 'data/base/augmented_npi_licensing.csv': 'NPI Licensing', 'data/base/augmented_passives.csv': 'Passives', 'data/base/augmented_quantifiers.csv': 'Quantifiers', 'data/base/augmented_relative_clauses.csv': 'Relative Clauses', 'data/base/augmented_scrambling.csv': 'Scrambling', 'data/base/augmented_subject_verb_agreement.csv': 'Subject Agreement', 'data/base/augmented_suspended_affixation.csv': 'Suspended Affixation'}\n"
|
| 70 |
+
]
|
| 71 |
+
}
|
| 72 |
+
],
|
| 73 |
+
"source": [
|
| 74 |
+
"phenomenons = [\n",
|
| 75 |
+
"\"Anaphor Agreement\",\n",
|
| 76 |
+
"\"Argument Str. Tran.\",\n",
|
| 77 |
+
"\"Argument Str. Ditr.\",\n",
|
| 78 |
+
"\"Binding\",\n",
|
| 79 |
+
"\"Determiners\",\n",
|
| 80 |
+
"\"Ellipsis\",\n",
|
| 81 |
+
"\"Irregular Forms\",\n",
|
| 82 |
+
"\"Island Effects\",\n",
|
| 83 |
+
"\"Nominalization\",\n",
|
| 84 |
+
"\"NPI Licensing\",\n",
|
| 85 |
+
"\"Passives\",\n",
|
| 86 |
+
"\"Quantifiers\",\n",
|
| 87 |
+
"\"Relative Clauses\",\n",
|
| 88 |
+
"\"Scrambling\",\n",
|
| 89 |
+
"\"Subject Agreement\",\n",
|
| 90 |
+
"\"Suspended Affixation\",\n",
|
| 91 |
+
"]\n",
|
| 92 |
+
"\n",
|
| 93 |
+
"# data/base/augmented_anaphor_agreement.csv -> Anaphor Agreement\n",
|
| 94 |
+
"data_task_names = [\n",
|
| 95 |
+
" \"data/base/augmented_anaphor_agreement.csv\",\n",
|
| 96 |
+
" \"data/base/augmented_argument_structure_transitive.csv\",\n",
|
| 97 |
+
" \"data/base/augmented_argument_structure_ditransitive.csv\",\n",
|
| 98 |
+
" \"data/base/augmented_binding.csv\",\n",
|
| 99 |
+
" \"data/base/augmented_determiners.csv\",\n",
|
| 100 |
+
" \"data/base/augmented_ellipsis.csv\",\n",
|
| 101 |
+
" \"data/base/augmented_irregular_forms.csv\",\n",
|
| 102 |
+
" \"data/base/augmented_island_effects.csv\",\n",
|
| 103 |
+
" \"data/base/augmented_nominalization.csv\",\n",
|
| 104 |
+
" \"data/base/augmented_npi_licensing.csv\",\n",
|
| 105 |
+
" \"data/base/augmented_passives.csv\",\n",
|
| 106 |
+
" \"data/base/augmented_quantifiers.csv\",\n",
|
| 107 |
+
" \"data/base/augmented_relative_clauses.csv\",\n",
|
| 108 |
+
" \"data/base/augmented_scrambling.csv\",\n",
|
| 109 |
+
" \"data/base/augmented_subject_verb_agreement.csv\",\n",
|
| 110 |
+
" \"data/base/augmented_suspended_affixation.csv\",\n",
|
| 111 |
+
"]\n",
|
| 112 |
+
"\n",
|
| 113 |
+
"task_phenomenon_mapping = {}\n",
|
| 114 |
+
"\n",
|
| 115 |
+
"for data_task_name, phenomenon in zip(data_task_names, phenomenons):\n",
|
| 116 |
+
" task_phenomenon_mapping[data_task_name] = phenomenon\n",
|
| 117 |
+
"print(task_phenomenon_mapping)"
|
| 118 |
+
]
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"cell_type": "code",
|
| 122 |
+
"execution_count": 40,
|
| 123 |
+
"id": "5c444bbe-93e7-4e85-8560-56bff13e1bb0",
|
| 124 |
+
"metadata": {},
|
| 125 |
+
"outputs": [
|
| 126 |
+
{
|
| 127 |
+
"name": "stdout",
|
| 128 |
+
"output_type": "stream",
|
| 129 |
+
"text": [
|
| 130 |
+
"['Phenomenon', 'dbmdz/electra-small-turkish-cased-generator', 'dbmdz/electra-base-turkish-cased-generator', 'dbmdz/electra-base-turkish-mc4-cased-generator', 'dbmdz/electra-base-turkish-mc4-uncased-generator', 'dbmdz/bert-base-turkish-cased', 'dbmdz/bert-base-turkish-uncased', 'dbmdz/bert-base-turkish-128k-cased', 'dbmdz/bert-base-turkish-128k-uncased', 'dbmdz/distilbert-base-turkish-cased', 'dbmdz/convbert-base-turkish-cased', 'dbmdz/convbert-base-turkish-mc4-cased', 'dbmdz/convbert-base-turkish-mc4-uncased']\n",
|
| 131 |
+
"[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
|
| 132 |
+
"[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
|
| 133 |
+
"[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
|
| 134 |
+
"[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
|
| 135 |
+
"[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
|
| 136 |
+
"[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
|
| 137 |
+
"[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
|
| 138 |
+
"[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
|
| 139 |
+
"[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
|
| 140 |
+
"[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
|
| 141 |
+
"[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
|
| 142 |
+
"[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n"
|
| 143 |
+
]
|
| 144 |
+
}
|
| 145 |
+
],
|
| 146 |
+
"source": [
|
| 147 |
+
"headers = [\"Phenomenon\"] + model_names\n",
|
| 148 |
+
"\n",
|
| 149 |
+
"print(headers)\n",
|
| 150 |
+
"\n",
|
| 151 |
+
"table = []\n",
|
| 152 |
+
"\n",
|
| 153 |
+
"for model_name in model_names:\n",
|
| 154 |
+
" phenomenon_accuracy_mapping = {}\n",
|
| 155 |
+
" \n",
|
| 156 |
+
" with open(model_name_evaluation_filename_mapping[model_name], \"rt\") as f_p:\n",
|
| 157 |
+
" \n",
|
| 158 |
+
" for line in f_p:\n",
|
| 159 |
+
" data = json.loads(line)\n",
|
| 160 |
+
"\n",
|
| 161 |
+
" current_task_name = data[\"file_name\"]\n",
|
| 162 |
+
" current_task_accuracy = round(data[\"accuracy\"], 2)\n",
|
| 163 |
+
" \n",
|
| 164 |
+
" phenomenon_accuracy_mapping[current_task_name] = current_task_accuracy\n",
|
| 165 |
+
"\n",
|
| 166 |
+
" for data_task_name in data_task_names:\n",
|
| 167 |
+
" phenomenon = task_phenomenon_mapping[data_task_name]\n",
|
| 168 |
+
" accuracy = phenomenon_accuracy_mapping[data_task_name]\n",
|
| 169 |
+
" table.append([phenomenon, accuracy])\n",
|
| 170 |
+
" print(current_row)\n",
|
| 171 |
+
"\n",
|
| 172 |
+
"#print(tabulate(table, headers=headers))"
|
| 173 |
+
]
|
| 174 |
+
}
|
| 175 |
+
],
|
| 176 |
+
"metadata": {
|
| 177 |
+
"kernelspec": {
|
| 178 |
+
"display_name": "Python 3 (ipykernel)",
|
| 179 |
+
"language": "python",
|
| 180 |
+
"name": "python3"
|
| 181 |
+
},
|
| 182 |
+
"language_info": {
|
| 183 |
+
"codemirror_mode": {
|
| 184 |
+
"name": "ipython",
|
| 185 |
+
"version": 3
|
| 186 |
+
},
|
| 187 |
+
"file_extension": ".py",
|
| 188 |
+
"mimetype": "text/x-python",
|
| 189 |
+
"name": "python",
|
| 190 |
+
"nbconvert_exporter": "python",
|
| 191 |
+
"pygments_lexer": "ipython3",
|
| 192 |
+
"version": "3.12.3"
|
| 193 |
+
}
|
| 194 |
+
},
|
| 195 |
+
"nbformat": 4,
|
| 196 |
+
"nbformat_minor": 5
|
| 197 |
+
}
|