#!/usr/bin/env python
# coding: utf-8
# # The use of μονογενής (Nestle1904LFT)
#
# **Work in progress!**
# ## Table of content
# * 1 - Introduction
# * 1.1 - Why is this relevant?
# * 1.2 - Translating into Text-Fabric queries
# * 2 - Load Text-Fabric app and data
# * 3 - Performing the queries
# * 3.1 - Rendering of the word μονογενής
# * 3.1.1 - Note 1: The impact of accented Greek Text
# * 3.1.2 - Note 2: Alternative method to identify verses
# * 3.1.3 - Note 3: Obtaining verse info from otext
# * 3.2 - Using show
# * 4 - Discussion
# * 5 - Atribution and footnotes
# * 6 - Required libraries
# # 1 - Introduction
# ##### [Back to TOC](#TOC)
#
# How to translate and understand μονογενής (monogenēs).
# ## 1.1 - Why is this relevant?
# ##### [Back to TOC](#TOC)
#
# The Greek word "μονογενής" (monogenēs) is often used in the context of biblical texts, particularly in the New Testament, to describe Jesus Christ. Its precise meaning has been a subject of theological debate, as it can be translated in different ways, such as "only begotten" or "unique" or "one-of-a-kind."
#
# Consider for example John 3:16:
#
# > Οὕτως γὰρ ἠγάπησεν ὁ Θεὸς τὸν κόσμον, ὥστε τὸν Υἱὸν τὸν μονογενῆ ἔδωκεν, ἵναπᾶς ὁπι στεύων εἰς αὐτὸν μὴ ἀπόληται ἀλλ’ ἔχῃ ζωὴν αἰώνιον.
#
# The choice of translation can depend on the theological tradition and interpretation of the text. In some translations of the Bible, the word μονογενής in John 3:16 was translated as "only begotten" (e.g., in the King James Version), while others use "one and only" or "unique" to convey the idea of Jesus being unique and special.
#
# See also the entry in [Liddel-Scott-Jones Greek-English Lexicon](https://stephanus.tlg.uci.edu/lsj/#eid=70726) for more lexical details.
# ## 1.2 - Translating into Text-Fabric queries
# ##### [Back to TOC](#TOC)
#
# As the translation of μονογενής depends on the context of the word being used, we first need to search for all occurences of the lemma μονογενής.
# # 2 - Load Text-Fabric app and data
# ##### [Back to TOC](#TOC)
# In[1]:
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
# In[2]:
# Loading the Text-Fabric code
# Note: it is assumed Text-Fabric is installed in your environment
from tf.fabric import Fabric
from tf.app import use
# In[3]:
# load the N1904 app and data
N1904 = use ("tonyjurg/Nestle1904LFT", version="0.6", hoist=globals())
# In[4]:
# The following will push the Text-Fabric stylesheet to this notebook (to facilitate proper display with notebook viewer)
N1904.dh(N1904.getCss())
# In[5]:
# Set default view in a way to limit noise as much as possible.
N1904.displaySetup(condensed=True, multiFeatures=False, queryFeatures=False)
# # 3 - Performing the queries
# ##### [Back to TOC](#TOC)
# ## 3.1 - Rendering of the word μονογενής
# ##### [Back to TOC](#TOC)
#
# 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.
# In[6]:
count=0
print ('count\t location\t translation')
for node in F.otype.s('word'):
lemma=F.lemma.v(node)
if lemma == 'μονογενής':
count+=1
book=F.book.v(node)
chapter=F.chapter.v(node)
verse=F.verse.v(node)
word=F.word.v(node)
gloss=F.gloss.v(node)
print (count,'\t',book,chapter,':',verse,'\t', gloss)
# ### 3.1.1 - Note 1: The impact of accented Greek Text ###
# ##### [Back to TOC](#TOC)
#
# 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 μονογενής).
# In[7]:
count=0
print ('count\t location\tword \t translation')
for node in F.otype.s('word'):
wordunacc=F.wordunacc.v(node)
if wordunacc == 'μονογενης':
count+=1
book=F.book.v(node)
chapter=F.chapter.v(node)
verse=F.verse.v(node)
word=F.word.v(node)
gloss=F.gloss.v(node)
print (count,'\t',book,chapter,':',verse,'\t', word,'\t', gloss)
# ### 3.1.2 - Note 2: Alternative method to identify verses ###
# ##### [Back to TOC](#TOC)
#
# 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:
#
#
#
# ### 3.1.3 - Note 3: Obtaining verse info from otext ###
# ##### [Back to TOC](#TOC)
#
# This is the same info as can be obtained from otext. This will result in the following snippet of code:
# In[8]:
for node in F.otype.s('word'):
lemma=F.lemma.v(node)
if lemma == 'μονογενής':
book, chapter, verse = T.sectionFromNode(node)
# Each element on the left hand side corresponds to an element in the tuple.
print (book,chapter,verse)
# ## 3.2 - Using show
# ##### [Back to TOC](#TOC)
# In[9]:
MonogenesQuery = '''
book
chapter
verse
word lemma=μονογενής
'''
MonogenesResults = N1904.search(MonogenesQuery)
# This will create a list containing ordered tuples consisting of node numbers of the items as they appear in the query
# Just print some of the results
N1904.show(MonogenesResults, start=1, end=1, condensed=True, multiFeatures=False)
# ## 4 - Discussion
# ##### [Back to TOC](#TOC)
#
# TBA
# # 5 - Attribution and footnotes
# ##### [Back to TOC](#TOC)
#
# N.A.
# # 6 - Required libraries
# ##### [Back to TOC](#TOC)
#
# The scripts in this notebook require (beside `text-fabric`) the following Python libraries to be installed in the environment:
#
# ???
#
# You can install any missing library from within Jupyter Notebook using either`pip` or `pip3`.