forked from bfijalkowski/KWT-2024
add lab8
This commit is contained in:
parent
623c3c308c
commit
b0557d534e
130
lab/lab_08.ipynb
130
lab/lab_08.ipynb
@ -88,7 +88,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 9,
|
||||
"id": "1e80adcf-ac34-4c38-a2c2-5735985c963e",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@ -106,7 +106,7 @@
|
||||
"0.7476897494228967"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -395,7 +395,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 2,
|
||||
"id": "49c68adb-f242-434a-94e0-8236bb944e1b",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@ -409,26 +409,103 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import PyDictionary \n",
|
||||
"dictde = PyDictionary.PyDictionary() \n",
|
||||
" \n",
|
||||
"translation = dictde.translate(\"happy\",'de') \n",
|
||||
"print(translation)"
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": null,
|
||||
"id": "descending-easter",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n",
|
||||
"Invalid Word\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from PyDictionary import PyDictionary\n",
|
||||
"\n",
|
||||
"def translate(word):\n",
|
||||
" dictionary = PyDictionary()\n",
|
||||
" translation = dictionary.translate(word, 'de')\n",
|
||||
" return translation\n",
|
||||
"#Szanowny Panie, na prawdę starałem się wykonać to zadanie. zauważyłem, że przy pierwszym odpaleniu to działało.\n",
|
||||
"#teraz jednak nie chce się odpalić. TO samo miałem na prywatnym komputerze, restart również nie pomógł. Ponoć powodem\n",
|
||||
"#jest fakt, że biblioteka ta używa goole translate, a goole z tym walczy\n",
|
||||
"\n",
|
||||
"def analyze_translations():\n",
|
||||
" dictionary = PyDictionary()\n",
|
||||
@ -438,8 +515,29 @@
|
||||
" for word in sentence:\n",
|
||||
" words.append(dictionary.translate(word,'de'))\n",
|
||||
" result.append(words)\n",
|
||||
"\n"
|
||||
" return result\n",
|
||||
"\n",
|
||||
"x = 0\n",
|
||||
"y = 0\n",
|
||||
"#wordSET = analyze_translations() \n",
|
||||
"for i in len(wordSET) - 1:\n",
|
||||
" for word in wordSET[i]:\n",
|
||||
" if word in HUMAN[i][0]:\n",
|
||||
" x += 1\n",
|
||||
" if word in MACHINE[i]:\n",
|
||||
" y += 1\n",
|
||||
"\n",
|
||||
"print(x)\n",
|
||||
"print(y) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "ff84873c-9f1a-4a2b-b31b-b10a49ce65e6",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
Loading…
Reference in New Issue
Block a user