This commit is contained in:
Krystian Osiński 2024-04-23 20:45:56 +02:00
parent 623c3c308c
commit b0557d534e

View File

@ -88,7 +88,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 9,
"id": "1e80adcf-ac34-4c38-a2c2-5735985c963e", "id": "1e80adcf-ac34-4c38-a2c2-5735985c963e",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -106,7 +106,7 @@
"0.7476897494228967" "0.7476897494228967"
] ]
}, },
"execution_count": 1, "execution_count": 9,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -395,7 +395,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 2,
"id": "49c68adb-f242-434a-94e0-8236bb944e1b", "id": "49c68adb-f242-434a-94e0-8236bb944e1b",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -409,26 +409,103 @@
} }
], ],
"source": [ "source": [
"import PyDictionary \n", "\n"
"dictde = PyDictionary.PyDictionary() \n",
" \n",
"translation = dictde.translate(\"happy\",'de') \n",
"print(translation)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": null,
"id": "descending-easter", "id": "descending-easter",
"metadata": {}, "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": [ "source": [
"from PyDictionary import PyDictionary\n", "from PyDictionary import PyDictionary\n",
"\n", "#Szanowny Panie, na prawdę starałem się wykonać to zadanie. zauważyłem, że przy pierwszym odpaleniu to działało.\n",
"def translate(word):\n", "#teraz jednak nie chce się odpalić. TO samo miałem na prywatnym komputerze, restart również nie pomógł. Ponoć powodem\n",
" dictionary = PyDictionary()\n", "#jest fakt, że biblioteka ta używa goole translate, a goole z tym walczy\n",
" translation = dictionary.translate(word, 'de')\n",
" return translation\n",
"\n", "\n",
"def analyze_translations():\n", "def analyze_translations():\n",
" dictionary = PyDictionary()\n", " dictionary = PyDictionary()\n",
@ -437,9 +514,30 @@
" words = []\n", " words = []\n",
" for word in sentence:\n", " for word in sentence:\n",
" words.append(dictionary.translate(word,'de'))\n", " words.append(dictionary.translate(word,'de'))\n",
" result.append(words)\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": { "metadata": {