"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# The following will push the Text-Fabric stylesheet to this notebook (to facilitate proper display with notebook viewer)\n",
"N1904.dh(N1904.getCss())"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "4e07279a-2830-4a68-9a5c-e448247381ad",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# Set default view in a way to limit noise as much as possible.\n",
"N1904.displaySetup(condensed=True, multiFeatures=False, queryFeatures=False)"
]
},
{
"cell_type": "markdown",
"id": "6cee9712-ae79-477c-9f39-1a51e3a0a8a1",
"metadata": {},
"source": [
"# 3 - Performing the queries \n",
"##### [Back to TOC](#TOC)"
]
},
{
"cell_type": "markdown",
"id": "e2b752ab-1b2a-46f3-a079-fe0a45555b8d",
"metadata": {},
"source": [
"## 3.1 - Rendering of the word μονογενής \n",
"##### [Back to TOC](#TOC)\n",
"\n",
"The following script gathers all occurrences of the *lemma* 'μονογενής' and displays its English gloss stored in the TF database. This confirms that the word is interpreted (and translated) differently in different contexts."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "7dc0bcba-58a5-49c4-b2bd-2d9c5149786d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"count\t location\t translation\n",
"1 \t Luke 7 : 12 \t only begotten\n",
"2 \t Luke 8 : 42 \t an only\n",
"3 \t Luke 9 : 38 \t an only child\n",
"4 \t John 1 : 14 \t of an only begotten\n",
"5 \t John 1 : 18 \t [the] only begotten\n",
"6 \t John 3 : 16 \t only begotten\n",
"7 \t John 3 : 18 \t only begotten\n",
"8 \t Hebrews 11 : 17 \t only begotten son\n",
"9 \t I_John 4 : 9 \t one and only\n"
]
}
],
"source": [
"count=0\n",
"print ('count\\t location\\t translation')\n",
"for node in F.otype.s('word'):\n",
" lemma=F.lemma.v(node)\n",
" if lemma == 'μονογενής':\n",
" count+=1\n",
" book=F.book.v(node)\n",
" chapter=F.chapter.v(node)\n",
" verse=F.verse.v(node)\n",
" word=F.word.v(node)\n",
" gloss=F.gloss.v(node)\n",
" print (count,'\\t',book,chapter,':',verse,'\\t', gloss)"
]
},
{
"cell_type": "markdown",
"id": "0ec16172-51e6-46cb-aba5-1b8087b23241",
"metadata": {},
"source": [
"### 3.1.1 - Note 1: The impact of accented Greek Text ### \n",
"##### [Back to TOC](#TOC)\n",
"\n",
"If the search was based upon occurances of the occurance of the #surface text word# μονογενής, a different set of results are found. In the example below, the compare is performed on the unaccented word. The importance of this can be seen from the results (i.e. Luke 8 : 42 has μονογενὴς and Luke 9 : 38 μονογενής)."
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "514905cd-5739-4e2f-9de6-b690f6f145bf",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"count\t location\tword \t translation\n",
"1 \t Luke 7 : 12 \t μονογενὴς \t only begotten\n",
"2 \t Luke 8 : 42 \t μονογενὴς \t an only\n",
"3 \t Luke 9 : 38 \t μονογενής \t an only child\n",
"4 \t John 1 : 18 \t μονογενὴς \t [the] only begotten\n"
]
}
],
"source": [
"count=0\n",
"print ('count\\t location\\tword \\t translation')\n",
"for node in F.otype.s('word'):\n",
" wordunacc=F.wordunacc.v(node)\n",
" if wordunacc == 'μονογενης':\n",
" count+=1\n",
" book=F.book.v(node)\n",
" chapter=F.chapter.v(node)\n",
" verse=F.verse.v(node)\n",
" word=F.word.v(node)\n",
" gloss=F.gloss.v(node)\n",
" print (count,'\\t',book,chapter,':',verse,'\\t', word,'\\t', gloss)"
]
},
{
"cell_type": "markdown",
"id": "92c3c256",
"metadata": {},
"source": [
"### 3.1.2 - Note 2: Alternative method to identify verses ### \n",
"##### [Back to TOC](#TOC)\n",
"\n",
"An alternative method to identify the verse where μονογενής is pressent, is to use `T.sectionFromNode(node)`. The resultant tuple structure can be determined from the output of `T.structureInfo()`. See following image:\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "4224bcce-df0d-4108-934c-1309cfe9e5f8",
"metadata": {},
"source": [
"### 3.1.3 - Note 3: Obtaining verse info from otext ### \n",
"##### [Back to TOC](#TOC)\n",
"\n",
"This is the same info as can be obtained from otext. This will result in the following snippet of code:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "a14a4701",
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Luke 7 12\n",
"Luke 8 42\n",
"Luke 9 38\n",
"John 1 14\n",
"John 1 18\n",
"John 3 16\n",
"John 3 18\n",
"Hebrews 11 17\n",
"I_John 4 9\n"
]
}
],
"source": [
"for node in F.otype.s('word'):\n",
" lemma=F.lemma.v(node)\n",
" if lemma == 'μονογενής':\n",
" book, chapter, verse = T.sectionFromNode(node) \n",
" # Each element on the left hand side corresponds to an element in the tuple.\n",
" print (book,chapter,verse)"
]
},
{
"cell_type": "markdown",
"id": "47a87214-feb2-4b04-9057-91f302ba600c",
"metadata": {
"tags": []
},
"source": [
"## 3.2 - Using show \n",
"##### [Back to TOC](#TOC)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "d2f0f841-cf4a-4433-8aef-f496db01ef62",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.09s 9 results\n"
]
},
{
"data": {
"text/html": [
"verse 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"verse Luke 7:12
sentence #283 (start: Luke 7:12)
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"MonogenesQuery = '''\n",
"book \n",
" chapter \n",
" verse \n",
" word lemma=μονογενής\n",
"'''\n",
"MonogenesResults = N1904.search(MonogenesQuery)\n",
"# This will create a list containing ordered tuples consisting of node numbers of the items as they appear in the query\n",
"\n",
"# Just print some of the results\n",
"N1904.show(MonogenesResults, start=1, end=1, condensed=True, multiFeatures=False)"
]
},
{
"cell_type": "markdown",
"id": "6fec4876-9bbe-49fd-8706-8a7e74d78bbc",
"metadata": {},
"source": [
"## 4 - Discussion\n",
"##### [Back to TOC](#TOC)\n",
"\n",
"TBA"
]
},
{
"cell_type": "markdown",
"id": "93759e73-fb2f-41cd-8067-6adbda8418fc",
"metadata": {},
"source": [
"# 5 - Attribution and footnotes\n",
"##### [Back to TOC](#TOC)\n",
"\n",
"N.A."
]
},
{
"cell_type": "markdown",
"id": "b0cb6fbf-ee41-426b-8557-573cdad74be2",
"metadata": {},
"source": [
"# 6 - 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",
" ???\n",
"\n",
"You can install any missing library from within Jupyter Notebook using either`pip` or `pip3`."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}