Work in progress!
This Jupyter Notebook showcases several examples of statistical analysis performed on a Text-Fabric corpus.
%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 N1904 app and data
N1904 = use ("tonyjurg/Nestle1904LFT", version="0.6", hoist=globals())
Locating corpus resources ...
The requested app is not available offline ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/app not found
The requested data is not available offline ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 not found
| 0.21s T otype from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 2.28s T oslots from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.49s T after from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.61s T unicode from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.62s T normalized from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.59s T wordunacc from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.60s T word from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.59s T wordtranslit from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.46s T verse from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.54s T chapter from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.58s T book from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | | 0.06s C __levels__ from otype, oslots, otext | | 1.84s C __order__ from otype, oslots, __levels__ | | 0.07s C __rank__ from otype, __order__ | | 3.36s C __levUp__ from otype, oslots, __rank__ | | 2.16s C __levDown__ from otype, __levUp__, __rank__ | | 0.22s C __characters__ from otext | | 0.97s C __boundary__ from otype, oslots, __rank__ | | 0.04s C __sections__ from otype, oslots, otext, __levUp__, __levels__, book, chapter, verse | | 0.22s C __structure__ from otype, oslots, otext, __rank__, __levUp__, book, chapter, verse | 0.44s T booknumber from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.50s T bookshort from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.49s T case from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.32s T clausetype from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.57s T containedclause from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.41s T degree from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.57s T gloss from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.47s T gn from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.03s T headverse from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.32s T junction from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.55s T lemma from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.51s T lex_dom from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.54s T ln from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.41s T markafter from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.42s T markbefore from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.41s T markorder from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.44s T monad from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.43s T mood from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.51s T morph from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.52s T nodeID from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.48s T nu from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.48s T number from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.43s T person from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.42s T punctuation from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.65s T ref from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.64s T reference from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.48s T roleclausedistance from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.48s T sentence from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.52s T sp from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.51s T sp_full from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.55s T strongs from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.44s T subj_ref from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.44s T tense from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.44s T type from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.44s T voice from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.37s T wgclass from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.33s T wglevel from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.35s T wgnum from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.34s T wgrole from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.34s T wgrolelong from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.38s T wgrule from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.33s T wgtype from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.49s T wordlevel from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.49s T wordrole from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6 | 0.50s T wordrolelong from ~/text-fabric-data/github/tonyjurg/Nestle1904LFT/tf/0.6
Name | # of nodes | # slots / node | % coverage |
---|---|---|---|
book | 27 | 5102.93 | 100 |
chapter | 260 | 529.92 | 100 |
verse | 7943 | 17.35 | 100 |
sentence | 8011 | 17.20 | 100 |
wg | 105430 | 6.85 | 524 |
word | 137779 | 1.00 | 100 |
3
tonyjurg/Nestle1904LFT
C:/Users/tonyj/text-fabric-data/github/tonyjurg/Nestle1904LFT/app
''
orig_order
verse
book
chapter
none
unknown
NA
''
0
text-orig-full
https://github.com/tonyjurg/Nestle1904LFT/blob/main/docs/
about
https://github.com/tonyjurg/Nestle1904LFT
https://github.com/tonyjurg/Nestle1904LFT/blob/main/docs/features/<feature>.md
layout-orig-full
}True
C:/Users/tonyj/text-fabric-data/github/tonyjurg/Nestle1904LFT/_temp
Nestle 1904 (Low Fat Tree)
notyet
tonyjurg
/tf
Nestle1904LFT
Nestle1904LFT
0.6
https://learner.bible/text/show_text/nestle1904/
Show this on the Bible Online Learner website
en
https://learner.bible/text/show_text/nestle1904/<1>/<2>/<3>
{webBase}/word?version={version}&id=<lid>
True
True
{book}
''
True
True
{chapter}
''
0
#{sentence} (start: {book} {chapter}:{headverse})
''
True
chapter verse
{book} {chapter}:{verse}
''
0
#{wgnum}: {wgtype} {wgclass} {clausetype} {wgrole} {wgrule} {junction}
''
True
lemma
gloss
chapter verse
grc
# The following will push the Text-Fabric stylesheet to this notebook (to facilitate proper display with notebook viewer)
N1904.dh(N1904.getCss())
# Set default view in a way to limit noise as much as possible.
N1904.displaySetup(condensed=True, multiFeatures=False, queryFeatures=False)
Although this is somewhat trivial, this example does serve a purpose. We will print te version by means of calling the Text-Fabric parameter VERSION which is fixed for the whole programm. To access any of these parameters in our notebook, it first needs to be imported from tf.parameters
.
from tf.parameters import VERSION
print ('TextFabric version: {}'.format(VERSION))
TextFabric version: 12.1.5
Note that any other parameters can be dumped in similar manner.
N1904.showContext(...)
3
tonyjurg/Nestle1904LFT
C:/Users/tonyj/text-fabric-data/github/tonyjurg/Nestle1904LFT/app
''
orig_order
verse
book
chapter
none
unknown
NA
''
0
text-orig-full
https://github.com/tonyjurg/Nestle1904LFT/blob/main/docs/
about
https://github.com/tonyjurg/Nestle1904LFT
https://github.com/tonyjurg/Nestle1904LFT/blob/main/docs/features/<feature>.md
layout-orig-full
}True
C:/Users/tonyj/text-fabric-data/github/tonyjurg/Nestle1904LFT/_temp
Nestle 1904 (Low Fat Tree)
notyet
tonyjurg
/tf
Nestle1904LFT
Nestle1904LFT
0.6
https://learner.bible/text/show_text/nestle1904/
Show this on the Bible Online Learner website
en
https://learner.bible/text/show_text/nestle1904/<1>/<2>/<3>
{webBase}/word?version={version}&id=<lid>
True
True
{book}
''
True
True
{chapter}
''
0
#{sentence} (start: {book} {chapter}:{headverse})
''
True
chapter verse
{book} {chapter}:{verse}
''
0
#{wgnum}: {wgtype} {wgclass} {clausetype} {wgrole} {wgrule} {junction}
''
True
lemma
gloss
chapter verse
grc
sentence
wg
word
book
chapter
verse
sentence
wg
()
sentence
wg
word
word
word
word
word
3
tonyjurg/Nestle1904LFT
C:/Users/tonyj/text-fabric-data/github/tonyjurg/Nestle1904LFT/app
word
}set()
master
0
2
greek.html
How TF features represent text
https://annotation.github.io/text-fabric/tf/writing/greek.html
chapter
}verse
}wg
}sentence
}word
}verse
Nestle 1904 (Low Fat Tree)
''
orig_order
verse
book
chapter
none
unknown
NA
''
0
text-orig-full
txtu grc
word
sentence
verse
wg
chapter
book
word
sentence
verse
wg
chapter
wg
word
sentence
wg
word
sentence
verse
wg
word
ltr
https://github.com/tonyjurg/Nestle1904LFT/blob/main/docs/
.md
about
https://github.com/tonyjurg/Nestle1904LFT
https://github.com/tonyjurg/Nestle1904LFT/blob/main/docs//about.md
How TF features represent text
https://annotation.github.io/text-fabric/tf/writing/greek.html
https://github.com/tonyjurg/Nestle1904LFT/blob/main/docs/
.md
about
https://github.com/tonyjurg/Nestle1904LFT
https://github.com/tonyjurg/Nestle1904LFT/blob/main/docs//about.md
https://github.com/tonyjurg/Nestle1904LFT/blob/main/docs/features/<feature>.md
home
notyet
set()
Matthew 1:1
<code>Matthew 1:1</code>
orig_order
verse
book
chapter
{}
grc
https://github.com/tonyjurg/Nestle1904LFT/blob/main/docs/features/<feature>.md
home
[]
{}
[]
{}
[]
{}
[]
{}
[]
{}
lemma
]{}
[]
{}
[]
{}
[]
{}
[]
{}
[]
{}
gloss
]{}
text-orig-full
txtn
txtn
txtu grc
txtn
txtn
set()
{}
txtn
txtu grc
txtp
txto
txtt
set()
chapter
book
0
0
True
0
True
True
True
0
0
True
0
0
True
{book}
book
]{chapter}
chapter
]#{sentence} (start: {book} {chapter}:{headverse})
sentence
book
chapter
headverse
{book} {chapter}:{verse}
book
chapter
verse
#{wgnum}: {wgtype} {wgclass} {clausetype} {wgrole} {wgrule} {junction}
wgnum
wgtype
wgclass
clausetype
wgrole
wgrule
junction
True
()
greek
children hor wrap
contnr c4
lbl c4
children hor wrap
contnr c4
lbl c4
children hor wrap
contnr c2
lbl c2
children hor wrap
contnr c3
lbl c3
children hor wrap
contnr c1
lbl c1
''
contnr c0
lbl c0
hor
4
True
True
hor
4
True
True
hor
2
True
True
hor
3
True
True
hor
1
True
True
ver
0
0
0
{}
set()
{}
C:/Users/tonyj/text-fabric-data/github/tonyjurg/Nestle1904LFT/_temp
()
set()
none
unknown
NA
''
tonyjurg
master
Nestle 1904 (Low Fat Tree)
notyet
()
tonyjurg
/tf
Nestle1904LFT
0.6
https://learner.bible/text/show_text/nestle1904/
Show this on the Bible Online Learner website
en
https://learner.bible/text/show_text/nestle1904/<1>/<2>/<3>
https://learner.bible/text/show_text/nestle1904//word?version=0.6&id=<lid>
/tf
Nestle1904LFT
:
0
''
''
''
''
''
True
()
True
()
''
()
''
()
''
()
True
()
text-orig-full
https://annotation.github.io/text-fabric/tf
True
True
{book}
''
True
True
{chapter}
''
0
#{sentence} (start: {book} {chapter}:{headverse})
''
True
chapter verse
{book} {chapter}:{verse}
''
0
#{wgnum}: {wgtype} {wgclass} {clausetype} {wgrole} {wgrule} {junction}
''
True
lemma
gloss
chapter verse
<github>
https://nbviewer.jupyter.org/github
verse
}0.6
https://learner.bible/text/show_text/nestle1904/
Show this on the Bible Online Learner website
en
https://learner.bible/text/show_text/nestle1904/<1>/<2>/<3>
https://learner.bible/text/show_text/nestle1904//word?version=0.6&id=<lid>
grc
Nestle1904LFT
]In this example the header of the loaded Text-Fabric dataset is dumped. This is done by means of an API call to A.header()
.
Please note that in the example below A
is replaced by N1904
. This is result of the method of incantation:
N1904 = use (... etc ... )
The use
function returns an oject whose attributes and methods constitute the advanced API. In the
N1904.header(allMeta=False)
Name | # of nodes | # slots / node | % coverage |
---|---|---|---|
book | 27 | 5102.93 | 100 |
chapter | 260 | 529.92 | 100 |
verse | 7943 | 17.35 | 100 |
sentence | 8011 | 17.20 | 100 |
wg | 105430 | 6.85 | 524 |
word | 137779 | 1.00 | 100 |
3
tonyjurg/Nestle1904LFT
C:/Users/tonyj/text-fabric-data/github/tonyjurg/Nestle1904LFT/app
''
orig_order
verse
book
chapter
none
unknown
NA
''
0
text-orig-full
https://github.com/tonyjurg/Nestle1904LFT/blob/main/docs/
about
https://github.com/tonyjurg/Nestle1904LFT
https://github.com/tonyjurg/Nestle1904LFT/blob/main/docs/features/<feature>.md
layout-orig-full
}True
C:/Users/tonyj/text-fabric-data/github/tonyjurg/Nestle1904LFT/_temp
Nestle 1904 (Low Fat Tree)
notyet
tonyjurg
/tf
Nestle1904LFT
Nestle1904LFT
0.6
https://learner.bible/text/show_text/nestle1904/
Show this on the Bible Online Learner website
en
https://learner.bible/text/show_text/nestle1904/<1>/<2>/<3>
{webBase}/word?version={version}&id=<lid>
True
True
{book}
''
True
True
{chapter}
''
0
#{sentence} (start: {book} {chapter}:{headverse})
''
True
chapter verse
{book} {chapter}:{verse}
''
0
#{wgnum}: {wgtype} {wgclass} {clausetype} {wgrole} {wgrule} {junction}
''
True
lemma
gloss
chapter verse
grc
The following API call footprint
provides a nicely formatted overview of memory footprint for each of the features in the Text_fabric corpus.
TF.footprint()
feature | members | size in bytes |
---|---|---|
levUp | 259,450 | 41,713,080 |
ref | 137,779 | 17,322,488 |
reference | 137,779 | 17,322,488 |
oslots | 3 | 15,801,460 |
levDown | 121,671 | 14,355,792 |
monad | 137,779 | 12,951,416 |
nodeID | 137,779 | 12,695,390 |
boundary | 2 | 12,320,324 |
unicode | 137,779 | 11,836,548 |
word | 137,779 | 11,208,988 |
normalized | 137,779 | 11,109,174 |
wordunacc | 137,779 | 11,064,793 |
gloss | 137,779 | 10,313,083 |
wordtranslit | 137,779 | 10,122,641 |
containedclause | 137,779 | 9,884,154 |
lemma | 137,779 | 9,669,633 |
book | 154,020 | 9,557,063 |
chapter | 153,993 | 9,554,764 |
ln | 137,779 | 9,532,539 |
subj_ref | 137,779 | 9,454,578 |
strongs | 137,779 | 9,382,659 |
sentence | 145,790 | 9,350,252 |
order | 259,450 | 9,340,240 |
verse | 145,722 | 9,323,176 |
lex_dom | 137,779 | 9,198,777 |
morph | 137,779 | 9,160,456 |
wordlevel | 137,779 | 9,108,780 |
roleclausedistance | 137,779 | 9,108,670 |
bookshort | 137,806 | 9,102,960 |
booknumber | 137,806 | 9,101,528 |
sp_full | 137,779 | 9,101,394 |
sp | 137,779 | 9,101,351 |
wordrolelong | 137,779 | 9,101,348 |
type | 137,779 | 9,101,345 |
wordrole | 137,779 | 9,101,278 |
mood | 137,779 | 9,101,174 |
tense | 137,779 | 9,101,160 |
case | 137,779 | 9,101,108 |
markafter | 137,779 | 9,101,102 |
after | 137,779 | 9,101,054 |
markbefore | 137,779 | 9,101,052 |
voice | 137,779 | 9,101,049 |
punctuation | 137,779 | 9,101,048 |
markorder | 137,779 | 9,101,021 |
gn | 137,779 | 9,100,991 |
person | 137,779 | 9,100,984 |
degree | 137,779 | 9,100,941 |
nu | 137,779 | 9,100,933 |
number | 137,779 | 9,100,933 |
wgnum | 105,430 | 8,645,128 |
wgrule | 105,430 | 8,243,720 |
wglevel | 105,430 | 8,199,368 |
wgrole | 105,430 | 8,195,670 |
wgrolelong | 105,430 | 8,195,576 |
wgclass | 105,430 | 8,195,569 |
clausetype | 105,430 | 8,195,219 |
wgtype | 105,430 | 8,195,162 |
junction | 105,430 | 8,195,108 |
structure | 6 | 3,095,470 |
rank | 259,450 | 1,077,884 |
otype | 4 | 973,860 |
sections | 2 | 570,276 |
headverse | 8,011 | 523,269 |
characters | 5 | 99,055 |
levels | 6 | 1,300 |
TOTAL | 7,967,669 | 613,490,794 |
The API call A.isLoaded()
will show information about loaded features.
N1904.isLoaded()
__boundary__ computed __characters__ computed __levDown__ computed __levUp__ computed __levels__ computed __order__ computed __rank__ computed __sections__ computed __structure__ computed after node (str) ✅ Characters (eg. punctuations) following the word book node (str) ✅ Book name (in English language) booknumber node (int) ✅ NT book number (Matthew=1, Mark=2, ..., Revelation=27) bookshort node (str) ✅ Book name (abbreviated) case node (str) ✅ Gramatical case (Nominative, Genitive, Dative, Accusative, Vocative) chapter node (int) ✅ Chapter number inside book clausetype node (str) ✅ Clause type details (e.g. Verbless, Minor) containedclause node (str) 🆗 Contained clause (WG number) degree node (str) ✅ Degree (e.g. Comparitative, Superlative) gloss node (str) ✅ English gloss gn node (str) ✅ Gramatical gender (Masculine, Feminine, Neuter) headverse node (str) ✅ Start verse number of a sentence junction node (str) ✅ Junction data related to a wordgroup lemma node (str) ✅ Lexeme (lemma) lex_dom node (str) ✅ Lexical domain according to Semantic Dictionary of Biblical Greek, SDBG (not present everywhere?) ln node (str) ✅ Lauw-Nida lexical classification (not present everywhere?) markafter node (str) 🆗 Text critical marker after word markbefore node (str) 🆗 Text critical marker before word markorder node (str) Order of punctuation and text critical marker monad node (int) ✅ Monad (smallest token matching word order in the corpus) mood node (str) ✅ Gramatical mood of the verb (passive, etc) morph node (str) ✅ Morphological tag (Sandborg-Petersen morphology) nodeID node (str) ✅ Node ID (as in the XML source data) normalized node (str) ✅ Surface word with accents normalized and trailing punctuations removed nu node (str) ✅ Gramatical number (Singular, Plural) number node (str) ✅ Gramatical number of the verb (e.g. singular, plural) orig_order NOT LOADED oslots edge otext config otype node (str) person node (str) ✅ Gramatical person of the verb (first, second, third) punctuation node (str) ✅ Punctuation after word ref node (str) ✅ Value of the ref ID (taken from XML sourcedata) reference node (str) ✅ Reference (to nodeID in XML source data, not yet post-processes) roleclausedistance node (str) ⚠️ Distance to the wordgroup defining the syntactical role of this word sentence node (int) ✅ Sentence number (counted per chapter) sp node (str) ✅ Part of Speech (abbreviated) sp_full node (str) ✅ Part of Speech (long description) strongs node (str) ✅ Strongs number subj_ref node (str) 🆗 Subject reference (to nodeID in XML source data, not yet post-processes) tense node (str) ✅ Gramatical tense of the verb (e.g. Present, Aorist) type node (str) ✅ Gramatical type of noun or pronoun (e.g. Common, Personal) unicode node (str) ✅ Word as it apears in the text in Unicode (incl. punctuations) verse node (int) ✅ Verse number inside chapter voice node (str) ✅ Gramatical voice of the verb (e.g. active,passive) wgclass node (str) ✅ Class of the wordgroup (e.g. cl, np, vp) wglevel node (int) 🆗 Number of the parent wordgroups for a wordgroup wgnum node (int) ✅ Wordgroup number (counted per book) wgrole node (str) ✅ Syntactical role of the wordgroup (abbreviated) wgrolelong node (str) ✅ Syntactical role of the wordgroup (full) wgrule node (str) ✅ Wordgroup rule information (e.g. Np-Appos, ClCl2, PrepNp) wgtype node (str) ✅ Wordgroup type details (e.g. group, apposition) word node (str) ✅ Word as it appears in the text (excl. punctuations) wordlevel node (str) 🆗 Number of the parent wordgroups for a word wordrole node (str) ✅ Syntactical role of the word (abbreviated) wordrolelong node (str) ✅ Syntactical role of the word (full) wordtranslit node (str) 🆗 Transliteration of the text (in latin letters, excl. punctuations) wordunacc node (str) ✅ Word without accents (excl. punctuations)
This example will show various statistics on node types. The call to C.levels.data
results in list of ordered tuples which will be nicely displayed using the tabulate function.
# Library to format table
from tabulate import tabulate
headers = ["Node", "Avarage # of slots","first","last"]
ResultList= C.levels.data
print(tabulate(ResultList, headers=headers, tablefmt='fancy_grid'))
╒══════════╤══════════════════════╤═════════╤════════╕ │ Node │ Avarage # of slots │ first │ last │ ╞══════════╪══════════════════════╪═════════╪════════╡ │ book │ 5102.93 │ 137780 │ 137806 │ ├──────────┼──────────────────────┼─────────┼────────┤ │ chapter │ 529.919 │ 137807 │ 138066 │ ├──────────┼──────────────────────┼─────────┼────────┤ │ verse │ 17.346 │ 146078 │ 154020 │ ├──────────┼──────────────────────┼─────────┼────────┤ │ sentence │ 17.1987 │ 138067 │ 146077 │ ├──────────┼──────────────────────┼─────────┼────────┤ │ wg │ 6.85239 │ 154021 │ 259450 │ ├──────────┼──────────────────────┼─────────┼────────┤ │ word │ 1 │ 1 │ 137779 │ ╘══════════╧══════════════════════╧═════════╧════════╛
for NodeType in F.otype.all:
print (NodeType, F.otype.sInterval(NodeType))
book (137780, 137806) chapter (137807, 138066) verse (146078, 154020) sentence (138067, 146077) wg (154021, 259450) word (1, 137779)
Note that the ranges shown as output of this command are (except, possibly with repect to order) the same as found in file otype.tf
:
@node
@TextFabric version=11.4.10
...
@valueType=str
@writtenBy=Text-Fabric
@dateWritten=2023-06-19T16:21:20Z
1-137779 word
137780-137806 book
137807-138066 chapter
138067-154190 clause
154191-226864 phrase
226865-232584 sentence
232585-240527 verse