This Jupyter Notebook shows the method of selecting a specific verse from the Greek New Testament corpus for display or further processing.
%load_ext autoreload
%autoreload 2
The autoreload extension is already loaded. To reload it, use: %reload_ext autoreload
# 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 N1904 app and data
N1904 = use ("tonyjurg/Nestle1904GBI", version="0.4", hoist=globals())
Locating corpus resources ...
Name | # of nodes | # slots / node | % coverage |
---|---|---|---|
book | 27 | 5102.93 | 100 |
chapter | 260 | 529.92 | 100 |
sentence | 5720 | 24.09 | 100 |
verse | 7943 | 17.35 | 100 |
clause | 16124 | 8.54 | 100 |
phrase | 72674 | 1.90 | 100 |
word | 137779 | 1.00 | 100 |
3
tonyjurg/Nestle1904GBI
C:/Users/tonyj/text-fabric-data/github/tonyjurg/Nestle1904GBI/app
671c7903caf2cdaa57866014bc3915a2840d4646
reference
]none
unknown
NA
''
layout-orig-full
}True
local
C:/Users/tonyj/text-fabric-data/github/tonyjurg/Nestle1904GBI/_temp
Nestle 1904 (GBI nodes)
tonyjurg
/tf
Nestle1904GBI
Nestle1904GBI
0.4
https://bibleol.3bmoodle.dk/text/show_text/nestle1904/<1>/<2>/<3>
0.4
{book}
''
#{clause}
''
#{phrase}
''
lemma
strongs
gloss
]# The following will push the Text-Fabric stylesheet to this notebook (to facilitate proper display with notebook viewer)
N1904.dh(N1904.getCss())
The following example will query for a specific verte (i.e. Matthew 1:8). As expected, the query yealds one result.
# Define the query template
VerseQuery = '''
book book=Matthew
chapter chapter=1
verse verse=8
'''
# The following will create a list containing ordered tuples consisting of node numbers of the items as they appear in the query
VerseResult = N1904.search(VerseQuery)
# Print some of the results
N1904.show(VerseResult, start=1, end=2, condensed=True, extraFeatures={'sp', 'clauserule', 'phrasefunction'}, multiFeatures=False)
0.01s 1 result
verse 1
A similar (but still different) result can be obtained by selecting all words from the verse individualy. Since counting each word as separate result, the total figure for results is higher (in this case 15). Also note that the found items (i.e. individual words) are coloured yellow. The argument "condensed=True"
combines all found items, limiting the display to just one instance of the verse (since all results are from the same verse). Would the argument "condensed=False"
be suplied, the same verse would be printed 15 times, each time with the next consequent word coloured in yellow.
# Define the query template
AltVerseQuery = '''
word book=Matthew chapter=1 verse=8
'''
# The following will create a list containing ordered tuples consisting of node numbers of the items as they appear in the query
AltVerseResult = N1904.search(AltVerseQuery)
# Print some of the results
N1904.show(AltVerseResult, start=1, end=15, condensed=True, multiFeatures=False)
0.09s 15 results
verse 1
N1904.showFormats()
format | level | template |
---|---|---|
text-orig-full |
word | {word}{after} |
The same result (although formatted different, since an ordered tuple is returned) can be obtained by the following call:
T.formats
{'text-orig-full': 'word'}
Note that this data originates from file otext.tf
:
@config
...
@fmt:text-orig-full={word}{after}
...
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 eitherpip
or pip3
.