\"\n",
" \n",
" # Process each cross-reference and add a row to the table\n",
" for target, confidence in crossRefs:\n",
" targetSection = T.sectionFromNode(target)\n",
" targetText = T.text(target)\n",
" \n",
" targetStepBible = (\n",
" f\"\"\n",
" f\"{targetSection[0]} {targetSection[1]}:{targetSection[2]}\"\n",
" ) \n",
" # Highlight identical parts in target verse\n",
" highlightedText = highlightMatches(mainVerseText, targetText)\n",
" \n",
" # Add the row for the cross-reference\n",
" tableContent += f\"
{targetStepBible}
{confidence}%
{highlightedText}
\"\n",
" \n",
" # Close the table\n",
" tableContent += \"
\"\n",
"\n",
" return tableContent\n",
"\n",
"# Initialize HTML content\n",
"reportTitle=f'Lexical parallels for parasha {parashaNameEnglish} ({parashaStart}-{parashaEnd})'\n",
"htmlContent = f\"
{reportTitle}
\"\n",
"\n",
"# Process each verse and generate cross-reference tables\n",
"for verse in parashaResults:\n",
" htmlContent += generateCrossReferencesTable(verse[0])\n",
"\n",
"# Display the HTML content in the notebook\n",
"display(HTML(htmlContent))\n",
"\n",
"# Define the HTML filename and store to file\n",
"fileName = f\"lexical_parallels({parashaNameEnglish.replace(' ','_')}).html\"\n",
"htmlContentFull = wrapHTML(htmlContent,reportTitle)\n",
"with open(fileName, \"w\", encoding=\"utf-8\") as file:\n",
" file.write(htmlContentFull)\n",
" \n",
"# display download button\n",
"downloadButton = f\"\"\"\n",
"', '>').replace('\"', '"').replace(\"'\", ''')}\" target=\"_blank\">\n",
" \n",
"\n",
"\"\"\"\n",
"display(HTML(downloadButton))"
]
},
{
"cell_type": "markdown",
"id": "93852912-fa5c-420a-88ed-8be3b090eb3a",
"metadata": {
"tags": []
},
"source": [
"# 4 - Required libraries \n",
"##### [Back to ToC](#TOC)\n",
"\n",
"The scripts in this notebook require (beside `text-fabric`) the following Python libraries to be installed in the environment:\n",
"\n",
" difflib\n",
" IPython\n",
"\n",
"You can install any missing library from within Jupyter Notebook using either`pip` or `pip3`."
]
},
{
"cell_type": "markdown",
"id": "bc5b6c04-4855-4d2d-aa9a-a1dac0256074",
"metadata": {},
"source": [
"# 5 - Further reading \n",
"##### [Back to ToC](#TOC)\n",
"\n",
"For an elaborate treatment of parallel passages, see:\n",
"\n",
"> Willem Th. van Peursen and Eep Talstra. \"Computer-Assisted Analysis of Parallel Texts in the Bible - The Case of 2 Kings xviii-xix and its Parallels in Isaiah and Chronicles\" in *Vetus Testamentum* 57, pp. 45-72. 2007, Brill, Leiden."
]
},
{
"cell_type": "markdown",
"id": "68573424-b71f-4596-95e7-468cf9ef9c1e",
"metadata": {},
"source": [
"# 6 - Notebook version details\n",
"##### [Back to ToC](#TOC)\n",
"\n",
"