#!/usr/bin/env python
# coding: utf-8
# # The use of μονογενής (Nestle1904GBI)
# ## 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.2 - Using show
# # 1 - Introduction
# ##### [Back to TOC](#TOC)
#
# How to translate and understand μονογενής - whether it means "only begotten" or just "unique".
# ## 1.1 - Why is this relevant?
# ##### [Back to TOC](#TOC)
#
# Consider for example John 3:16:
#
# > Οὕτως γὰρ ἠγάπησεν ὁ Θεὸς τὸν κόσμον, ὥστε τὸν Υἱὸν τὸν μονογενῆ ἔδωκεν, ἵναπᾶς ὁπι στεύων εἰς αὐτὸν μὴ ἀπόληται ἀλλ’ ἔχῃ ζωὴν αἰώνιον.
#
# Does this imply that Jesus was begotten of God. But the adjective μονογενής can just mean one-of-a-kind or unique. See also the entry in [Liddel-Scott-Jones Greek-English Lexicon](https://stephanus.tlg.uci.edu/lsj/#eid=70726).
# ## 1.2 - Translating into Text-Fabric queries
# ##### [Back to TOC](#TOC)
#
# We 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[1]:
# 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/Nestle1904GBI", version="0.3", hoist=globals())
# In[ ]:
# The following will push the Text-Fabric stylesheet to this notebook (to facilitate proper display with notebook viewer)
N1904.dh(N1904.getCss())
# # 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 rendering.
# In[4]:
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_EN.v(node)
print (count,'\t',book,chapter,':',verse,'\t', gloss)
# Alternative method to identify the verse location is to use `T.sectionFromNode(node)`. The resultant tuple structure can be determined from the output of `T.structureInfo()`. See following image:
#
#
#
# This is the same info as can be obtained from otext
#
# This will result in the following sniplet of code:
# In[5]:
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[4]:
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=True)
# In[ ]: