Ran files

This commit is contained in:
Henry Dowd
2026-02-27 04:56:34 +00:00
parent 84ee1dc246
commit 3d755fca3e
4 changed files with 829 additions and 769 deletions

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "d2aa2997",
"metadata": {},
"outputs": [
@@ -40,7 +40,7 @@
" \n",
" # Edge cases\n",
" (\"Short.\", \"Short.\"), # Very short\n",
" (\"A B C D E F G\", \"A B C D E F G\"), # Repeated words\n",
" (\"A B C D E F G\", \"A B C D E F G\"), # Repeated words\n",
" (\"\", \"\"), # Empty strings\n",
"]\n",
"print(\"done\")"
@@ -56,7 +56,7 @@
},
{
"cell_type": "code",
"execution_count": 58,
"execution_count": 3,
"id": "e60d024e969254a",
"metadata": {
"ExecuteTime": {
@@ -121,7 +121,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 4,
"id": "0b68fdcd",
"metadata": {},
"outputs": [
@@ -130,18 +130,19 @@
"output_type": "stream",
"text": [
"Sentence 1 Sentence 2: Similarities -> Char: Word:\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"
"====================================================================================================\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"
]
}
],
@@ -193,7 +194,15 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": null,
"id": "9e20739a",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 5,
"id": "46a985b4",
"metadata": {},
"outputs": [
@@ -268,7 +277,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"id": "7dc7ac2e",
"metadata": {},
"outputs": [
@@ -346,7 +355,7 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 7,
"id": "e6a4d4e2",
"metadata": {},
"outputs": [
@@ -415,7 +424,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "493979a4",
"metadata": {},
"outputs": [],
@@ -444,7 +453,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 9,
"id": "b3d07562",
"metadata": {},
"outputs": [
@@ -665,7 +674,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.7"
"version": "3.13.12"
}
},
"nbformat": 4,