notebook2

This commit is contained in:
Henry Dowd
2025-12-10 19:43:28 +00:00
parent a370b68cb1
commit 726c6b276b

View File

@@ -121,7 +121,7 @@
},
{
"cell_type": "code",
"execution_count": 57,
"execution_count": 1,
"id": "0b68fdcd",
"metadata": {},
"outputs": [
@@ -130,19 +130,18 @@
"output_type": "stream",
"text": [
"Sentence 1 Sentence 2: Similarities -> Char: Word:\n",
"====================================================================================================\n",
"The cat sat on the mat. vs The cat sat on the mat. 1.000 1.000 \n",
"The cat sat on the mat. vs The cat sat on the mat 0.957 0.833 \n",
"The cat sat on the mat. vs The cat sat on the mat. 0.821 1.000 \n",
"The cat sat on the mat. vs On the mat, the cat was sitting. 0.344 0.143 \n",
"The cat sat on the mat. vs The feline rested on the rug. 0.517 0.500 \n",
"The quick brown fox jumps. vs A fast brown fox leaps. 0.577 0.400 \n",
"The cat sat on the mat. vs The dog ran in the park. 0.625 0.333 \n",
"I love programming. vs She enjoys reading books. 0.200 0.000 \n",
"The weather is nice today. vs It's raining outside. 0.192 0.000 \n",
"Short. vs Short. 1.000 1.000 \n",
"A B C D E F G vs A B C D E F G 1.000 1.000 \n",
" vs 1.000 1.000 \n"
"====================================================================================================\n"
]
},
{
"ename": "NameError",
"evalue": "name 'test_pairs' is not defined",
"output_type": "error",
"traceback": [
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
"\u001b[31mNameError\u001b[39m Traceback (most recent call last)",
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[1]\u001b[39m\u001b[32m, line 31\u001b[39m\n\u001b[32m 28\u001b[39m \u001b[38;5;28mprint\u001b[39m(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[33m'\u001b[39m\u001b[33mSentence 1\u001b[39m\u001b[33m'\u001b[39m\u001b[38;5;132;01m:\u001b[39;00m\u001b[33m<41\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[33m'\u001b[39m\u001b[33mSentence 2:\u001b[39m\u001b[33m'\u001b[39m\u001b[38;5;132;01m:\u001b[39;00m\u001b[33m<20\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[33m'\u001b[39m\u001b[33mSimilarities ->\u001b[39m\u001b[33m'\u001b[39m\u001b[38;5;132;01m:\u001b[39;00m\u001b[33m<19\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[33m'\u001b[39m\u001b[33mChar:\u001b[39m\u001b[33m'\u001b[39m\u001b[38;5;132;01m:\u001b[39;00m\u001b[33m<10\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[33m'\u001b[39m\u001b[33mWord:\u001b[39m\u001b[33m'\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m)\n\u001b[32m 29\u001b[39m \u001b[38;5;28mprint\u001b[39m(\u001b[33m\"\u001b[39m\u001b[33m=\u001b[39m\u001b[33m\"\u001b[39m * \u001b[32m100\u001b[39m)\n\u001b[32m---> \u001b[39m\u001b[32m31\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m sent1, sent2 \u001b[38;5;129;01min\u001b[39;00m \u001b[43mtest_pairs\u001b[49m:\n\u001b[32m 32\u001b[39m char_similarity = char_levenshtein_similarity(sent1, sent2)\n\u001b[32m 33\u001b[39m word_similarity = word_levenshtein_similarity(sent1, sent2)\n",
"\u001b[31mNameError\u001b[39m: name 'test_pairs' is not defined"
]
}
],