{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "955a0385-29fb-47dc-b012-729e49570594",
   "metadata": {},
   "outputs": [],
   "source": [
    "from new_experiment.utils.get_spacy_model_name import *\n",
    "\n",
    "from call_experiment_stats import *\n",
    "\n",
    "from new_experiment.utils.property_helper import PropertyHelper\n",
    "from new_experiment.utils.get_spacy_model_name import get_spacy_model_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "9f5e44a6-f211-4b61-8cb4-5636c7672c6a",
   "metadata": {},
   "outputs": [],
   "source": [
    "COMMANDS = ['run_word_wer_classic_pipeline', 'run_word_wer_embedding_pipeline', 'run_spacy_dep_tag_wer_pipeline',\n",
    "            'run_spacy_ner_wer_pipeline', 'run_spacy_pos_wer_pipeline']\n",
    "LANGUAGES = ['nl', 'fr', 'de', 'it', 'pl', 'es', 'en']\n",
    "WHISPER_ASR_MODEL = ['tiny', 'base', 'small', 'medium', 'large-v2']\n",
    "DATASETS = ['google_fleurs', 'minds14', 'voxpopuli']\n",
    "FULL_DATASET_NAMES = []\n",
    "for itt in LANGUAGES:\n",
    "    for it in DATASETS:\n",
    "        FULL_DATASET_NAMES.append(f'{itt}_{it}')\n",
    "        \n",
    "FULL_LANGUAGE_MODELS = [f'whisper_{it}' for it in WHISPER_ASR_MODEL]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "22d84451-b7e3-4dba-9758-068dae23ace4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.1875, 0.0, 0.3125, 0.2962962962962963, 0.2857142857142857, 0.2608695652173913, 0.29411764705882354, 0.43137254901960786, 0.45454545454545453, 0.2608695652173913, 0.25, 0.17647058823529413, 0.21666666666666667, 0.3076923076923077, 0.38461538461538464, 0.625, 0.1111111111111111, 0.3684210526315789, 0.15384615384615385, 0.16666666666666666, 0.2777777777777778, 0.17142857142857143, 0.12121212121212122, 0.14285714285714285, 0.35, 0.05, 0.125, 0.2857142857142857, 0.0, 0.22727272727272727, 0.47058823529411764, 0.7142857142857143, 0.3333333333333333, 4.461538461538462, 0.13043478260869565, 0.09090909090909091, 0.24, 0.21739130434782608, 0.3333333333333333, 0.20689655172413793, 0.25925925925925924, 0.35294117647058826, 0.27586206896551724, 0.4166666666666667, 0.29411764705882354, 0.3333333333333333, 0.17647058823529413, 0.25, 0.05263157894736842, 0.3333333333333333, 0.6, 0.1875, 0.36363636363636365, 0.10810810810810811, 0.17142857142857143, 0.1, 0.3793103448275862, 0.2413793103448276, 0.34782608695652173, 0.34782608695652173, 0.2608695652173913, 0.21875, 0.125, 0.18181818181818182, 0.1875, 0.15789473684210525, 0.19230769230769232, 0.35294117647058826, 0.15789473684210525, 0.4230769230769231, 0.058823529411764705, 0.12121212121212122, 0.23076923076923078, 0.375, 0.23076923076923078, 0.20689655172413793, 0.18181818181818182, 0.22580645161290322, 0.8, 0.2857142857142857, 0.5454545454545454, 0.35714285714285715, 0.09090909090909091, 0.2857142857142857, 0.15384615384615385, 0.2692307692307692, 0.46153846153846156, 0.2777777777777778, 0.5384615384615384, 0.4375, 0.4, 0.09090909090909091, 1.0, 0.5238095238095238, 0.23809523809523808, 0.2608695652173913, 0.15, 0.5555555555555556, 0.14285714285714285, 0.38095238095238093, 1.6666666666666667, 0.3333333333333333, 0.7083333333333334, 0.48, 0.1935483870967742, 0.2222222222222222, 0.4, 0.08333333333333333, 0.2857142857142857, 0.15, 0.35294117647058826, 0.14814814814814814, 0.4444444444444444, 0.1111111111111111, 0.2857142857142857, 0.14285714285714285, 0.47058823529411764, 0.38095238095238093, 0.38095238095238093, 0.13043478260869565, 0.17857142857142858, 0.17391304347826086, 0.3333333333333333, 0.4117647058823529, 0.7857142857142857, 0.2727272727272727, 0.37037037037037035, 0.15789473684210525, 0.1875, 0.2777777777777778, 0.3076923076923077, 0.2903225806451613, 0.16666666666666666, 0.38461538461538464, 0.45, 0.35, 0.25806451612903225, 0.21428571428571427, 0.11764705882352941, 0.6666666666666666, 0.1, 0.13636363636363635, 0.20833333333333334, 0.3888888888888889, 1.0555555555555556, 0.1875, 0.7083333333333334, 0.5555555555555556, 0.3023255813953488, 0.1111111111111111, 0.5555555555555556, 0.21428571428571427, 0.6, 0.3235294117647059, 0.5789473684210527, 0.3333333333333333, 0.18181818181818182, 0.32, 0.2777777777777778, 0.4444444444444444, 0.2631578947368421, 0.5238095238095238, 0.23529411764705882, 0.05263157894736842, 0.92, 0.47058823529411764, 0.23076923076923078, 0.2727272727272727, 0.5263157894736842, 0.22727272727272727, 0.34615384615384615, 0.4, 0.6666666666666666, 0.2, 0.09090909090909091, 0.2, 0.21739130434782608, 0.21212121212121213, 0.047619047619047616, 0.24, 0.29411764705882354, 0.34615384615384615, 0.17857142857142858, 0.0, 0.3076923076923077, 0.14285714285714285, 0.038461538461538464, 0.2857142857142857, 0.2857142857142857, 0.22727272727272727, 0.25, 0.13333333333333333, 0.4444444444444444, 0.21951219512195122, 0.17391304347826086, 0.6296296296296297, 0.3333333333333333, 0.14814814814814814, 0.20833333333333334, 0.2222222222222222, 0.32, 0.06451612903225806, 0.07692307692307693, 0.29310344827586204, 0.11764705882352941, 0.10526315789473684, 0.4375, 0.3125, 0.14814814814814814, 0.2727272727272727, 0.46153846153846156, 0.20833333333333334, 0.125, 0.14285714285714285, 0.4666666666666667, 1.3, 0.4583333333333333, 0.13043478260869565, 0.17391304347826086, 0.3157894736842105, 0.17857142857142858, 0.4, 0.3157894736842105, 0.6363636363636364, 0.12195121951219512, 0.05, 0.2916666666666667, 0.24324324324324326, 0.3333333333333333, 0.21739130434782608, 0.38461538461538464, 0.15789473684210525, 0.15, 0.09523809523809523, 0.2777777777777778, 0.21212121212121213, 0.07692307692307693, 0.1111111111111111, 0.0625, 0.3793103448275862, 0.29411764705882354, 0.4090909090909091, 0.4444444444444444, 0.7777777777777778, 0.3076923076923077, 0.2777777777777778, 0.1724137931034483, 0.26666666666666666, 0.13333333333333333, 0.45454545454545453, 0.4375]\n",
      "nl_google_fleurs whisper_tiny__nl_core_news_lg__ner_metrics 0.3161237339690157\n",
      "[0.25, 0.07692307692307693, 0.125, 0.2962962962962963, 0.23809523809523808, 0.13043478260869565, 0.23529411764705882, 0.2549019607843137, 0.2727272727272727, 0.4583333333333333, 0.17391304347826086, 0.3, 0.35294117647058826, 0.19230769230769232, 0.38461538461538464, 0.25, 0.2222222222222222, 0.3157894736842105, 0.15384615384615385, 0.08333333333333333, 0.2777777777777778, 0.08571428571428572, 0.15151515151515152, 0.14285714285714285, 0.2, 0.15, 0.041666666666666664, 0.21428571428571427, 0.125, 0.2727272727272727, 0.058823529411764705, 0.35714285714285715, 0.06666666666666667, 0.23076923076923078, 0.13043478260869565, 0.09090909090909091, 0.12, 0.21739130434782608, 0.5238095238095238, 0.13793103448275862, 0.07407407407407407, 0.29411764705882354, 0.27586206896551724, 0.4166666666666667, 0.16666666666666666, 0.11764705882352941, 0.11764705882352941, 0.16666666666666666, 0.05263157894736842, 0.3333333333333333, 0.6, 0.46875, 0.2727272727272727, 0.13513513513513514, 0.17142857142857143, 0.27586206896551724, 0.15, 0.20689655172413793, 0.34782608695652173, 0.15625, 0.21739130434782608, 0.17391304347826086, 0.125, 0.13636363636363635, 0.125, 0.29411764705882354, 0.3684210526315789, 0.15384615384615385, 0.10526315789473684, 0.058823529411764705, 0.34615384615384615, 0.030303030303030304, 0.1935483870967742, 0.2916666666666667, 0.3076923076923077, 0.13793103448275862, 0.06060606060606061, 0.20512820512820512, 0.4666666666666667, 0.14285714285714285, 0.18181818181818182, 0.42857142857142855, 0.15384615384615385, 0.17857142857142858, 0.18181818181818182, 0.23076923076923078, 0.38461538461538464, 0.3333333333333333, 0.23076923076923078, 1.625, 0.4, 0.09090909090909091, 0.23809523809523808, 0.3333333333333333, 0.3333333333333333, 0.2, 0.08695652173913043, 0.3333333333333333, 0.10714285714285714, 0.2857142857142857, 0.0, 0.13333333333333333, 0.4166666666666667, 0.24, 0.06451612903225806, 0.3888888888888889, 0.1, 0.16666666666666666, 0.1111111111111111, 0.2, 0.29411764705882354, 0.14285714285714285, 0.3333333333333333, 0.1111111111111111, 0.23809523809523808, 0.09523809523809523, 0.11764705882352941, 0.14285714285714285, 0.2857142857142857, 0.08695652173913043, 0.17857142857142858, 0.2857142857142857, 0.08695652173913043, 0.35294117647058826, 0.14285714285714285, 0.36363636363636365, 0.05263157894736842, 0.0625, 0.25, 0.25925925925925924, 0.23076923076923078, 0.2777777777777778, 0.12903225806451613, 0.23076923076923078, 0.1, 0.2, 0.0967741935483871, 2.5, 0.17647058823529413, 0.5833333333333334, 0.0, 0.0, 0.08333333333333333, 0.1111111111111111, 0.2222222222222222, 0.25, 0.625, 0.4444444444444444, 0.13953488372093023, 0.2222222222222222, 0.3333333333333333, 0.14285714285714285, 0.4666666666666667, 0.23529411764705882, 0.7368421052631579, 0.0, 0.2777777777777778, 0.13333333333333333, 0.1111111111111111, 0.12, 0.19047619047619047, 0.05263157894736842, 0.23529411764705882, 0.05263157894736842, 0.24, 0.38235294117647056, 0.19230769230769232, 0.22727272727272727, 0.42105263157894735, 0.36363636363636365, 0.07692307692307693, 0.2, 0.25, 0.1, 0.18181818181818182, 0.2, 0.043478260869565216, 0.23809523809523808, 0.06060606060606061, 0.32, 0.17647058823529413, 0.38461538461538464, 0.17857142857142858, 0.19230769230769232, 0.3076923076923077, 0.047619047619047616, 0.038461538461538464, 0.38095238095238093, 0.14285714285714285, 0.13636363636363635, 0.06666666666666667, 0.10714285714285714, 0.3333333333333333, 0.12195121951219512, 0.043478260869565216, 0.6296296296296297, 0.2777777777777778, 0.14814814814814814, 0.08333333333333333, 0.1111111111111111, 0.2, 0.16129032258064516, 0.07692307692307693, 0.3103448275862069, 0.14705882352941177, 0.15789473684210525, 0.3125, 0.25, 0.2222222222222222, 0.18181818181818182, 0.125, 0.10256410256410256, 0.3333333333333333, 0.16666666666666666, 0.4666666666666667, 0.1, 0.17391304347826086, 0.4583333333333333, 0.08695652173913043, 0.2631578947368421, 0.17857142857142858, 0.26666666666666666, 0.42105263157894735, 0.8181818181818182, 0.4, 0.07317073170731707, 0.2916666666666667, 0.16216216216216217, 0.20833333333333334, 0.043478260869565216, 0.23076923076923078, 0.10526315789473684, 0.2, 0.2222222222222222, 0.14285714285714285, 0.12121212121212122, 0.11538461538461539, 0.1388888888888889, 0.25, 0.5172413793103449, 0.29411764705882354, 0.13636363636363635, 0.2222222222222222, 0.15384615384615385, 0.4074074074074074, 0.2777777777777778, 0.13793103448275862, 0.13333333333333333, 0.13333333333333333, 0.45454545454545453, 0.125]\n",
      "nl_google_fleurs whisper_base__nl_core_news_lg__ner_metrics 0.23084502550941563\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "KeyboardInterrupt\n",
      "\n"
     ]
    }
   ],
   "source": [
    "[\n",
    "    [\n",
    "        get_stats_for(dataset, PropertyHelper.ner_metrics(model, get_spacy_model_name(dataset[:2])))\n",
    "        for model in FULL_LANGUAGE_MODELS\n",
    "    ]\n",
    "    for dataset in FULL_DATASET_NAMES\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "45fd851c-644f-48e6-b711-5bd312404b8b",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6466877e-e744-4cb1-8d4f-f818e1d3ee7d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}