#!/usr/bin/env python # coding: utf-8 # # The 'center' of the Torah (BHSA) # ## Table of content (ToC) # # * 1 - Introduction # * 2 - Load Text-Fabric app and data # * 3 - Performing the queries # * 3.1 - Center book (Leviticus) # * 3.2 - Center chapter (Leviticus Chapter 4) # * 3.3 - Center verse (Lev 8:9) # * 3.4 - Center sentence (Ex 36:11) # * 3.5 - Center clause (Lev 4:35) # * 3.6 - Center phrase (Lev 4:32) # * 3.7 - Center word based upon word node (Lev 8:21) # * 3.8 - Center word based on spaces and maqaf (Lev 8:15) # * 3.9 - Center word based upon using feature 'wordboundary' (Lev 8:15) # * 3.10 - Center word based on spaces (Lev 8:22) # * 3.11 - Center word based on selected part of speech (Lev 8:21) # * 3.12 - Other opinion - Stone Tenach (Lev 10:16) # * 4 - Attribution and footnotes # * 5 - Required libraries # * 6 - Notebook details # # # 1 - Introduction # ##### [Back to ToC](#TOC) # It is a common belief that the center of a text segment, a book, or a specific set of books contains the central message. This notebook explores various methods to answer the question, 'What is the center of the Torah?' The main prerequisite for answering this is determining by what measure this center is to be established. # # 2 - Load Text-Fabric app and data # ##### [Back to ToC](#TOC) # This NoteBook uses the ETCBC BHSA as dataset representing the Hebrew text of the TeNaCh. # In[2]: get_ipython().run_line_magic('load_ext', 'autoreload') get_ipython().run_line_magic('autoreload', '2') # In[3]: # 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[4]: # load the BHSL app and data BHS = use ("etcbc/BHSA",hoist=globals()) # Note: The Text-Fabric feature documentation can be found at [ETCBC GitHub](https://github.com/ETCBC/bhsa/blob/master/docs/features/0_home.md) # In[4]: # The following will push the Text-Fabric stylesheet to this notebook (to facilitate proper display with notebook viewer) BHS.dh(BHS.getCss()) # # 3 - Performing the queries # ##### [Back to ToC](#TOC) # An important feature used in the queries will be 'number'. This starts with 1. The manner of numbering objects differs per object type. The following are of interest for this research: # # type | numbering # --- | --- # phrase_atom | within the book # clause_atom | within the book # sentence_atom | within the book # word | within the book # # Note: Full Text-Fabric feature documentation is found [here](https://github.com/ETCBC/bhsa/blob/master/docs/features/number.md) # **Important observation:** The BHSA inserts nodes for implicit articles (which are only visable in the vocalisation). See example below: # # # ## 3.1 - Center book # ##### [Back to TOC](#TOC) # Rather trivially, Leviticus constitutes the center of the five books of the Torah. # ## 3.2 - Center chapter # ##### [Back to TOC](#TOC) # The following method is based upon the center chapter. # In[5]: # number of chapters in Torah ChapterQuery = ''' book book=Genesis|Exodus|Leviticus|Numeri|Deuteronomium chapter ''' ChapterResults = BHS.search(ChapterQuery) # In[6]: F.otype.sInterval('chapter') # In[7]: # start + delta: 426630 + int(187/2) = 426630 + 93 = 426723 T.sectionFromNode(426723) # ## 3.3 - Center verse # This method is based upon the middle verse in the Torah. # In[8]: # number of verses in Torah VerseQuery = ''' book book=Genesis|Exodus|Leviticus|Numeri|Deuteronomium verse ''' VerseResults = BHS.search(VerseQuery) # Determine boundaries of the verse node-numbers. # In[9]: F.otype.sInterval('verse') # In[10]: # start + delta: 1414389 + int(5853/2) = 1414389 + 2926 = 1417315 T.sectionFromNode(1417315) # In[11]: T.text(1417315) # In[12]: BHS.show(VerseResults,start=2926,end=2926, multiFeatures=False) # This verse in the King James Version: # > And he put the mitre upon his head; also upon the mitre, even upon his forefront, did he put the golden plate, the holy crown; as the Lord commanded Moses. # ## 3.4 - Center sentence # The following method is based upon the center sentence. In this method the sentence definition used is the one according to the ETCBC database, which at places differs from other databases. # In[13]: # number of sentences in Torah SentenceQuery = ''' book book=Genesis|Exodus|Leviticus|Numeri|Deuteronomium sentence ''' SentenceResults = BHS.search(SentenceQuery) # Determining the interval of sentence node-numbers. # In[14]: F.otype.sInterval('sentence') # In[15]: # start + delta: 1172308 + int(15088/2) = 1172308 + 7544 = 1179852 T.sectionFromNode(1179852) # In[16]: T.text(1179852) # In[17]: # 15088 results / 2 = 7544 BHS.show(SentenceResults,start=7544,end=7544,multiFeatures=False) # This sentence in the King James Version: # > and the other five curtains he coupled one unto another. # # Note that in the KJV this is a subsentence. # ## 3.5 - Center clause # The following method is based upon the center clause. In this method the clause definition used is the one according to the ETCBC database, which may slightly differ in other implementations. # In[18]: # number of clauses in Torah ClauseQuery = ''' book book=Genesis|Exodus|Leviticus|Numeri|Deuteronomium clause ''' ClauseResults = BHS.search(ClauseQuery) # Determining the interval of clause node-numbers. # In[19]: F.otype.sInterval('clause') # In[20]: # start + delta: 427559 + int(21181/2) = 427559 + 10590 = 438149 T.sectionFromNode(438149) # In[21]: T.text(438149) # In[22]: # 21181 results / 2 = 10590,5 -> midpoint = 10590 BHS.show(ClauseResults,start=10590,end=10590, multiFeatures=False) # In the King James Version: # > and shall pour out all the blood thereof at the bottom of the altar # # Note that while in the ETCBC BHSA sentences often contain multiple clauses, this clause constitutes a full sentence. # ## 3.6 - Center phrase # The following method is based upon the center phrase. In this method the clause definition used is the one according to the ETCBC database, following a more-or-less general understanding of what does constitute a phrase. # In[23]: # number of phrases in Torah PhraseQuery = ''' book book=Genesis|Exodus|Leviticus|Numeri|Deuteronomium phrase ''' PhraseResults = BHS.search(PhraseQuery) # Determining the interval of phrase node-numbers. # In[24]: F.otype.sInterval('phrase') # In[25]: # start + delta: 651573 + int(64195/2) = 651573 + 32097 = 683670 T.sectionFromNode(683670) # In[26]: T.text(683670) # In[27]: # 64195 results /2 = 32097,5 -> midpoint = 32098 BHS.show(PhraseResults,start=32098,end=32098,multiFeatures=False) # In the King James Version: # # > a female without blemish # ## 3.7 - Center word - based upon center word node # This method assumes the mathematical center of the list of word nodes provides us the center of the Torah. # In[28]: # number of words in Torah (WARNING: as per ETCBC definition!) WordQuery = ''' book book=Genesis|Exodus|Leviticus|Numeri|Deuteronomium word ''' WordResults = BHS.search(WordQuery) # The following code validates that the word nodes are numbered starting from '1'. # In[29]: F.otype.sInterval('word') # Find the midle word node # In[30]: # start + delta: 1 + int(112927/2) = 1 + 56463 = 56464 T.sectionFromNode(56464) # In[31]: T.text(56464) # In[32]: # 112927 results /2 = 56463,5 -> midpoint = 56464 BHS.show(WordResults,start=56464,end=56464,multiFeatures=False) # If this would be 'translated' into a meaningfull 'center' clause, it could be: # > 'wash in the water'. # ## 3.8 - Center word based on spaces and maqaf # Here the number of words in the Torah is determined by items separeted by spaces OR maqaf (diacritical mark indicating a strong connection between words). # # First check what can be placed after an individual word # In[33]: # note: this is for the full TeNaCH! F.trailer.freqList() # In this list, the ' ' value (i.e. a space) is used when the word is joined to the next word, while '&' indicates a maqqef (־), a diacritical mark indicating a strong connection between words. We consider both as word separators. Examining the frequency list above there are two methods to determine the word boundaries. The first is utilizing the fact that all feature values indicating a wordboundary are of lenght 1 or higher, allowing the string `(.+)` to exclude all cases where the lenght is less than 1 character. The other option is to explicitly look for spaces and maqqefs, by using `[\s&]` as regex expression. As expected, both product the same outcome. The following query determines the number of words in the torah based on this methond of counting. # In[34]: # define query template # The preceding 'r' before the template allows for a raw strings, preventing Python from altering the regex. WordQuery2 = r''' book book=Genesis|Exodus|Leviticus|Numeri|Deuteronomium word trailer~[\s&] ''' WordResults2 = BHS.search(WordQuery2) # Find the midpoint: 79886/2 = 39948 # In[36]: T.text(39949) # In[37]: BHS.show(WordResults2,start=39948,end=39948,multiFeatures=False) # Following this method, the center would be: # >and be holy # ## 3.9 - Center word based upon using feature 'wordboundary' # In this section we will use some of the additonal features made available by the [BHSaddons](https://github.com/tonyjurg/BHSaddons/) dataset. # In[61]: # load the app and data with additial features (removed the hoist here) BHSAadd = use ("etcbc/BHSA", mod="tonyjurg/BHSaddons/tf/:hot") # In[62]: # find all 'end-of-word' word nodes within any parasha wordboundaryQuery = ''' verse parashanum word wordboundary=1 ''' wordboundaryResult = BHSAadd.search(wordboundaryQuery) # In[63]: # find all word nodes within any parasha wordboundaryQuery = ''' verse parashanum word ''' wordboundaryResult = BHSAadd.search(wordboundaryQuery) # As can be seen from these queries, the result is (as expected) the same as for the previous section (3.8). # ## 3.10 - Center word based upon spaces # In the following method words are defined as items separeted by spaces. # In[38]: # following regexp selects for values of feature trailer that are 1 or more characters in length {alternative regex: (.+) } wordQuery3 = r''' book book=Genesis|Exodus|Leviticus|Numeri|Deuteronomium word trailer~\ $ ''' wordResults3 = BHS.search(wordQuery3) # In[39]: # Just to check: query for maqafs maqafQuery = ''' book book=Genesis|Exodus|Leviticus|Numeri|Deuteronomium word trailer=& ''' maqafResults = BHS.search(maqafQuery) # Check if the numbers do add up: 68434 (spaces) + 11452 (maqafs) =? 79886 (total) YES! # Find the midpoint in wordResults3: 68434/2 = 34217 and print its tuple: # In[40]: wordResults3[34216] # Print associated text (we need second element in tuple): # In[41]: T.text(wordResults3[34216][1]) # Displaying the syntax tree of the relevant verse: # In[43]: BHS.show(wordResults3,start=34217,end=34217,multiFeatures=False) # Following this method, the center would be: # > (on the) head of the ram # ## 3.11 - Center word based upon selected part of speech # The following method is intended to exclude items like the Nota Accusativus / object marker (את) where they have a purely gramatical function only. # In[ ]: wordQuery4 = ''' book book=Genesis|Exodus|Leviticus|Numeri|Deuteronomium word sp=adjv|advb|art|conj|intj|inrg|nega|nmpr|prep|prde|prin|prps|subs|verb ''' wordResults4 = BHS.search(wordQuery4) # midpoint: int(112927/2)=56463 # In[ ]: BHS.show(wordResults4,start=56463,end=56463,multiFeatures=False) # Following this method, the center would be: # >he washed in the water # ## 3.12 - Other opinion - Stone Tenach # According to the 'Stone Tanach':1 # >[Lev] 10:16 דָּרֹ֥שׁ דָּרַ֛שׁ - *inquired insistently* \[lit. *inquire he inquired*\]. This is the exact halfway mark of the word of the Torah. This teaches us that one must always *inquire;* one must never stop seeking an ever deeper and broader understanding of the Torah (*Degel Machaneh Ephraim*). # # 4 - Attribution and footnotes # ##### [Back to ToC](#TOC) # # #### Footnotes: # # 1Rabbi Nosson Scherman (ed), *The Stone Edition Tanach*, Hebrew and English Edition (Brooklyn NY: Mesorah Publications Ltd, 1996), 266. # # 5 - 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: # # {none} # # You can install any missing library from within Jupyter Notebook using either`pip` or `pip3`. # # 6 - Notebook details # ##### [Back to ToC](#TOC) # #
# # # # # # # # # # # # # #
AuthorTony Jurg
Version1.1
Date14 Novermber 2024
#