In Hebrew, the words for "heart" are written as follows:
This Jupyter NoteBook investigates occurances per book.
%load_ext autoreload
%autoreload 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
# load the BHSL app and data
BHS = use ("etcbc/BHSA",hoist=globals())
Locating corpus resources ...
Name | # of nodes | # slots / node | % coverage |
---|---|---|---|
book | 39 | 10938.21 | 100 |
chapter | 929 | 459.19 | 100 |
lex | 9230 | 46.22 | 100 |
verse | 23213 | 18.38 | 100 |
half_verse | 45179 | 9.44 | 100 |
sentence | 63717 | 6.70 | 100 |
sentence_atom | 64514 | 6.61 | 100 |
clause | 88131 | 4.84 | 100 |
clause_atom | 90704 | 4.70 | 100 |
phrase | 253203 | 1.68 | 100 |
phrase_atom | 267532 | 1.59 | 100 |
subphrase | 113850 | 1.42 | 38 |
word | 426590 | 1.00 | 100 |
3
etcbc/BHSA
C:/Users/tonyj/text-fabric-data/github/etcbc/BHSA/app
gd905e3fb6e80d0fa537600337614adc2af157309
''
<code>Genesis 1:1</code> (use <a href="https://github.com/{org}/{repo}/blob/master/tf/{version}/book%40en.tf" target="_blank">English book names</a>)
g_uvf_utf8
g_vbs
kq_hybrid
languageISO
g_nme
lex0
is_root
g_vbs_utf8
g_uvf
dist
root
suffix_person
g_vbe
dist_unit
suffix_number
distributional_parent
kq_hybrid_utf8
crossrefSET
instruction
g_prs
lexeme_count
rank_occ
g_pfm_utf8
freq_occ
crossrefLCS
functional_parent
g_pfm
g_nme_utf8
g_vbe_utf8
kind
g_prs_utf8
suffix_gender
mother_object_type
none
unknown
NA
{docRoot}/{repo}
''
''
https://{org}.github.io
0_home
{}
True
local
C:/Users/tonyj/text-fabric-data/github/etcbc/BHSA/_temp
BHSA = Biblia Hebraica Stuttgartensia Amstelodamensis
10.5281/zenodo.1007624
Phonetic Transcriptions
https://nbviewer.jupyter.org/github/etcbc/phono/blob/master/programs/phono.ipynb
10.5281/zenodo.1007636
etcbc
/tf
phono
Parallel Passages
https://nbviewer.jupyter.org/github/etcbc/parallels/blob/master/programs/parallels.ipynb
10.5281/zenodo.1007642
etcbc
/tf
parallels
etcbc
/tf
BHSA
2021
https://shebanq.ancient-data.org/hebrew
Show this on SHEBANQ
la
True
{webBase}/text?book=<1>&chapter=<2>&verse=<3>&version={version}&mr=m&qw=q&tp=txt_p&tr=hb&wget=v&qget=v&nget=vt
{webBase}/word?version={version}&id=<lid>
v1.8
{typ} {rela}
''
True
{code}
1
''
True
{label}
''
True
gloss
{voc_lex_utf8}
word
orig
{voc_lex_utf8}
{typ} {function}
''
True
{typ} {rela}
1
''
{number}
''
True
{number}
1
''
True
{number}
''
pdp vs vt
lex:gloss
hbo
Note: Thefeature documentation can be found at ETCBC GitHub
# The following will push the Text-Fabric stylesheet to this notebook (to facilitate proper display with notebook viewer)
BHS.dh(BHS.getCss())
levQuery = '''
book
chapter
verse
word lex=LBB/|LB/
'''
levResults = BHS.search(levQuery)
0.57s 861 results
# Libraries for table formatting and data display
import pandas as pd
from IPython.display import display
# Initialize dictionary for storing results
resultDict = {}
# Process each item in the levResults
for item in levResults:
book = F.book.v(item[0])
lex = F.lex.v(item[3])
if book in resultDict:
# If it exists, add the count to the existing value
resultDict[book][0] += 1
if lex == 'LB/':
resultDict[book][1] += 1
else:
resultDict[book][2] += 1
else:
# If it doesn't exist, initialize the count as the value
if lex == 'LB/':
resultDict[book] = [1, 1, 0]
else:
resultDict[book] = [1, 0, 1]
# Convert the dictionary into a DataFrame and sort by total frequency
tableData = pd.DataFrame(
[[key, value[0], value[1], value[2]] for key, value in resultDict.items()],
columns=["Book", "Total", "Lev", "Levav"]
)
tableData = tableData.sort_values(by="Total", ascending=False)
# Display the table
display(tableData)
Book | Total | Lev | Levav | |
---|---|---|---|---|
24 | Psalmi | 137 | 102 | 35 |
26 | Proverbia | 99 | 97 | 2 |
12 | Jeremia | 66 | 58 | 8 |
4 | Deuteronomium | 51 | 4 | 47 |
11 | Jesaia | 49 | 31 | 18 |
13 | Ezechiel | 47 | 41 | 6 |
1 | Exodus | 47 | 46 | 1 |
36 | Chronica_II | 44 | 16 | 28 |
29 | Ecclesiastes | 42 | 41 | 1 |
9 | Reges_I | 37 | 14 | 23 |
7 | Samuel_I | 30 | 16 | 14 |
25 | Iob | 29 | 20 | 9 |
35 | Chronica_I | 20 | 8 | 12 |
8 | Samuel_II | 20 | 18 | 2 |
6 | Judices | 16 | 14 | 2 |
0 | Genesis | 16 | 13 | 3 |
32 | Daniel | 15 | 3 | 12 |
10 | Reges_II | 14 | 6 | 8 |
14 | Hosea | 10 | 9 | 1 |
30 | Threni | 10 | 9 | 1 |
5 | Josua | 9 | 2 | 7 |
34 | Nehemia | 7 | 6 | 1 |
22 | Sacharia | 6 | 4 | 2 |
21 | Haggai | 5 | 0 | 5 |
3 | Numeri | 5 | 4 | 1 |
31 | Esther | 4 | 4 | 0 |
23 | Maleachi | 4 | 4 | 0 |
2 | Leviticus | 3 | 0 | 3 |
20 | Zephania | 3 | 1 | 2 |
33 | Esra | 3 | 2 | 1 |
28 | Canticum | 3 | 3 | 0 |
15 | Joel | 2 | 0 | 2 |
19 | Nahum | 2 | 1 | 1 |
17 | Obadia | 2 | 2 | 0 |
27 | Ruth | 2 | 2 | 0 |
18 | Jona | 1 | 0 | 1 |
16 | Amos | 1 | 1 | 0 |
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
# Sample data setup (replace with your actual data)
# Initialize dictionary for storing results
resultDict = {}
# Process each item in the levResults
for item in levResults:
book = F.book.v(item[0])
lex = F.lex.v(item[3])
if book in resultDict:
# If it exists, add the count to the existing value
resultDict[book][0] += 1
if lex == 'LB/':
resultDict[book][1] += 1
else:
resultDict[book][2] += 1
else:
# If it doesn't exist, initialize the count as the value
if lex == 'LB/':
resultDict[book] = [1, 1, 0]
else:
resultDict[book] = [1, 0, 1]
# Convert the dictionary into a DataFrame and sort by total frequency
tableData = pd.DataFrame(
[[key, value[0], value[1], value[2]] for key, value in resultDict.items()],
columns=["Book", "Total", "LB", "LBB"]
)
# Set up the data for plotting with LB as positive and LBB as negative values
tableData['LB_Positive'] = tableData['LB'] # LB counts as positive values
tableData['LBB_Negative'] = -tableData['LBB'] # LBB counts as negative values
# Set up the plot
plt.figure(figsize=(14, 10))
# Plot LB (positive values)
lb_bars = plt.barh(tableData["Book"], tableData["LB_Positive"], color='blue', label='לֵב')
# Plot LBB (negative values)
lbb_bars = plt.barh(tableData["Book"], tableData["LBB_Negative"], color='orange', label='לֵבָב')
# Add the counts on each bar
for bar, count in zip(lb_bars, tableData['LB']):
plt.text(bar.get_width() + 1, bar.get_y() + bar.get_height()/2, str(count), va='center', color='blue')
for bar, count in zip(lbb_bars, tableData['LBB']):
plt.text(bar.get_width() - 1, bar.get_y() + bar.get_height()/2, str(count), va='center', ha='right', color='orange')
# Customize x-axis to show absolute values
x_ticks = plt.xticks()[0] # Get current tick positions
plt.xticks(x_ticks, [str(int(abs(x))) for x in x_ticks]) # Set absolute values for labels
# Add labels, title, and legend
plt.xlabel("Count")
plt.ylabel("Book")
plt.title('Distribution of לֵב and לֵבָב Counts per Book in the Tenach')
plt.axvline(0, color="black", linewidth=0.5) # Center line at x=0
plt.legend(title="Category")
# Show the plot
plt.show()
The scripts in this notebook require (beside text-fabric
) the following Python libraries to be installed in the environment:
IPython
pandas
matplotlib
seaborn
You can install any missing library from within Jupyter Notebook using eitherpip
or pip3
.