%load_ext autoreload
%autoreload 2
from tf.app import use
from fixture import typeShow
A = use("bhsa:clone", checkout="clone", hoist=globals())
A.reuse()
A.showContext()
{}
baseTypes
:half_verse
sentence
sentence_atom
clause
clause_atom
phrase
phrase_atom
subphrase
word
condenseType
:book
chapter
verse
half_verse
sentence
sentence_atom
clause
clause_atom
phrase
phrase_atom
subphrase
hiddenTypes
:half_verse
sentence
sentence_atom
clause
clause_atom
phrase
phrase_atom
subphrase
textFormat
:lex-default
: word
lex-orig-full
: word
lex-orig-plain
: word
lex-trans-full
: word
lex-trans-plain
: word
text-orig-full
: word
text-orig-full-ketiv
: word
text-orig-plain
: word
text-phono-full
: word
text-trans-full
: word
text-trans-full-ketiv
: word
text-trans-plain
: word
None
bhsa
~/github/annotation/app-bhsa/code
word
set()
False
2
How TF features represent text
https://annotation.github.io/text-fabric/writing/hebrew.html
book
:chapter
chapter
:verse
clause
:clause_atom
clause_atom
:phrase
half_verse
:sentence
phrase
:phrase_atom
phrase_atom
:subphrase
sentence
:sentence_atom
sentence_atom
:clause
subphrase
:word
verse
:half_verse
sentence
None
verse
BHSA = Biblia Hebraica Stuttgartensia Amstelodamensis
empty
exampleSectionHtml
: <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>)
excludedFeatures
: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
noneValues
:none
unknown
NA
txtu hbo
book
:book
chapter
clause
clause_atom
half_verse
phrase
phrase_atom
sentence
sentence_atom
subphrase
verse
word
chapter
:chapter
clause
clause_atom
half_verse
phrase
phrase_atom
sentence
sentence_atom
subphrase
verse
word
clause
:clause
clause_atom
phrase
phrase_atom
subphrase
word
clause_atom
:clause_atom
phrase
phrase_atom
subphrase
word
half_verse
:clause
clause_atom
half_verse
phrase
phrase_atom
sentence
sentence_atom
subphrase
word
phrase
:phrase
phrase_atom
subphrase
word
phrase_atom
:phrase_atom
subphrase
word
sentence
:clause
clause_atom
phrase
phrase_atom
sentence
sentence_atom
subphrase
word
sentence_atom
:clause
clause_atom
phrase
phrase_atom
sentence_atom
subphrase
word
subphrase
:subphrase
word
verse
:clause
clause_atom
half_verse
phrase
phrase_atom
sentence
sentence_atom
subphrase
verse
word
rtl
https://etcbc.github.io/bhsa
empty
0_home
https://etcbc.github.io
https://etcbc.github.io/bhsa/0_home
charText
: How TF features represent text
charUrl
: https://annotation.github.io/text-fabric/writing/hebrew.html
docBase
: https://etcbc.github.io/bhsa
docExt
: emptydocPage
: 0_home
docRoot
: https://etcbc.github.io
docUrl
: https://etcbc.github.io/bhsa/0_home
featureBase
: https://etcbc.github.io/bhsa/features/<feature>
featurePage
: 0_home
10.5281/zenodo.1007624
Genesis 1:1
<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
{}
hbo
https://etcbc.github.io/bhsa/features/<feature>
0_home
clause
:clause_atom
:half_verse
:lex
:phrase
:phrase_atom
:sentence
:sentence_atom
:subphrase
:word
:pdp
vs
vt
clause
:clause_atom
:half_verse
:lex
:gloss
phrase
:phrase_atom
:sentence
:sentence_atom
:subphrase
:word
:gloss
gloss
: lex
lex-default
: txtn
lex-orig-full
: txtu hbo
lex-orig-plain
: txtu hbo
lex-trans-full
: txtt
lex-trans-plain
: txtt
text-orig-full
: txtu hbo
text-orig-full-ketiv
: txtu hbo
text-orig-plain
: txtu hbo
text-phono-full
: txtp
text-trans-full
: txtt
text-trans-full-ketiv
: txtt
text-trans-plain
: txtt
set()
{}
normal
: txtn
orig
: txtu hbo
phono
: txtp
source
: txto
trans
: txtt
None
set()
clause_atom
half_verse
phrase_atom
sentence_atom
subphrase
condensed
: FalsehideTypes
: True
lineNumbers
: NoneplainGaps
: True
prettyTypes
: True
queryFeatures
: True
showGraphics
: NonestandardFeatures
: FalsewithNodes
: FalsewithTypes
: FalseTrue
book
:True
chapter
:True
clause
:{typ} {rela}
typ
rela
clause_atom
:{code}
code
half_verse
:{label}
label
lex
:{voc_lex_utf8}
voc_lex_utf8
phrase
:{typ} {function}
typ
function
phrase_atom
:{typ} {rela}
typ
rela
sentence
:{number}
number
sentence_atom
:{number}
number
subphrase
:{number}
number
verse
:word
:True
hebrew
book
:children
: children hor wrap
container
: contnr c4
label
: lbl c4
chapter
:children
: children hor wrap
container
: contnr c4
label
: lbl c4
clause
:children
: children hor wrap
container
: contnr c2
label
: lbl c2
clause_atom
:children
: children hor wrap
container
: contnr c1
label
: lbl c1
half_verse
:children
: children hor wrap
container
: contnr c3
label
: lbl c3
lex
:children
: emptycontainer
: contnr c0
label
: lbl c0
phrase
:children
: children hor wrap
container
: contnr c1
label
: lbl c1
phrase_atom
:children
: children hor wrap
container
: contnr c1
label
: lbl c1
sentence
:children
: children hor wrap
container
: contnr c2
label
: lbl c2
sentence_atom
:children
: children hor wrap
container
: contnr c1
label
: lbl c1
subphrase
:children
: children hor wrap
container
: contnr c1
label
: lbl c1
verse
:children
: children hor wrap
container
: contnr c3
label
: lbl c3
word
:children
: emptycontainer
: contnr c0
label
: lbl c0
book
:flow
: hor
level
: 4
stretch
: True
wrap
: True
chapter
:flow
: hor
level
: 4
stretch
: True
wrap
: True
clause
:flow
: hor
level
: 2
stretch
: True
wrap
: True
clause_atom
:flow
: hor
level
: 1
stretch
: True
wrap
: True
half_verse
:flow
: hor
level
: 3
stretch
: True
wrap
: True
lex
:flow
: ver
level
: 0stretch
: Falsewrap
: Falsephrase
:flow
: hor
level
: 1
stretch
: True
wrap
: True
phrase_atom
:flow
: hor
level
: 1
stretch
: True
wrap
: True
sentence
:flow
: hor
level
: 2
stretch
: True
wrap
: True
sentence_atom
:flow
: hor
level
: 1
stretch
: True
wrap
: True
subphrase
:flow
: hor
level
: 1
stretch
: True
wrap
: True
verse
:flow
: hor
level
: 3
stretch
: True
wrap
: True
word
:flow
: ver
level
: 0stretch
: Falsewrap
: Falseword
: lex
lex
{}
clone
~/github/etcbc/bhsa/_temp
corpus
: Phonetic Transcriptions
docUrl
: https://nbviewer.jupyter.org/github/etcbc/phono/blob/master/programs/phono.ipynb
doi
: 10.5281/zenodo.1007636
org
: etcbc
relative
: tf
repo
: phono
corpus
: Parallel Passages
docUrl
: https://nbviewer.jupyter.org/github/etcbc/parallels/blob/master/programs/parallels.ipynb
doi
: 10.5281/zenodo.1007642
org
: etcbc
relative
: tf
repo
: parallels
lex
none
unknown
NA
etcbc
{}
{}
corpus
: BHSA = Biblia Hebraica Stuttgartensia Amstelodamensis
doi
: 10.5281/zenodo.1007624
graphicsRelative
: NonemoduleSpecs
:corpus
: Phonetic Transcriptions
docUrl
: https://nbviewer.jupyter.org/github/etcbc/phono/blob/master/programs/phono.ipynb
doi
: 10.5281/zenodo.1007636
org
: etcbc
relative
: tf
repo
: phono
corpus
: Parallel Passages
docUrl
: https://nbviewer.jupyter.org/github/etcbc/parallels/blob/master/programs/parallels.ipynb
doi
: 10.5281/zenodo.1007642
org
: etcbc
relative
: tf
repo
: parallels
org
: etcbc
relative
: tf
repo
: bhsa
version
: c
webBase
: https://shebanq.ancient-data.org/hebrew
webHint
: Show this on SHEBANQ
webLang
: la
webLexId
: True
webUrl
: https://shebanq.ancient-data.org/hebrew/text?book=<1>&chapter=<2>&verse=<3>&version=c&mr=m&qw=q&tp=txt_p&tr=hb&wget=v&qget=v&nget=vt
webUrlLex
: https://shebanq.ancient-data.org/hebrew/word?version=c&id=<lid>
zip
: Nonetf
None
bhsa
:
False
clause
: emptyclause_atom
: emptyhalf_verse
: emptylex
: txtu hbo
phrase
: emptyphrase_atom
: emptysentence
: emptysentence_atom
: emptysubphrase
: emptybook
:True
chapter
:True
clause
:clause_atom
:half_verse
:lex
:{voc_lex_utf8}
voc_lex_utf8
phrase
:phrase_atom
:sentence
:sentence_atom
:subphrase
:verse
:word
:True
text-orig-full
https://annotation.github.io/text-fabric
{}
clause
:label
: {typ} {rela}
style
: emptyclause_atom
:hidden
: True
label
: {code}
level
: 1
style
: emptyhalf_verse
:hidden
: True
label
: {label}
style
: emptyverselike
: True
lex
:featuresBare
: gloss
label
: {voc_lex_utf8}
lexOcc
: word
style
: orig
template
: {voc_lex_utf8}
phrase
:label
: {typ} {function}
style
: emptyphrase_atom
:hidden
: True
label
: {typ} {rela}
level
: 1
style
: emptysentence
:label
: {number}
style
: emptysentence_atom
:hidden
: True
label
: {number}
level
: 1
style
: emptysubphrase
:hidden
: True
label
: {number}
style
: emptyword
:features
: pdp vs vt
featuresBare
: lex:gloss
https://github.com
https://nbviewer.jupyter.org/github
half_verse
verse
c
https://shebanq.ancient-data.org/hebrew
Show this on SHEBANQ
la
True
https://shebanq.ancient-data.org/hebrew/text?book=<1>&chapter=<2>&verse=<3>&version=c&mr=m&qw=q&tp=txt_p&tr=hb&wget=v&qget=v&nget=vt
https://shebanq.ancient-data.org/hebrew/word?version=c&id=<lid>
hbo
bhsa
etcbc
phono
tf
etcbc
parallels
tf
A.displayShow("standardFeatures")
False
w = 2
p = L.u(w, otype="phrase")[0]
tree = A.unravel(w, explain=True)
<0> TOP <1> word 3461 {3461}
tree = A.unravel(p, explain=True)
<0> TOP <1> phrase 675477 {38612} <2> word 38612 {38612}
A.pretty(w, standardFeatures=True)
A.pretty(p, standardFeatures=True)
p = 675477
highlights = {p}
A.pretty(p, highlights=highlights)
A.pretty(p, highlights=highlights, baseTypes="phrase")
v = T.nodeFromSection(("Genesis", 7, 14))
v
1414527
A.plain(v, explain=False)
Halfverses are hidden. This verse is divided (at top level) in 3 spans: one for each clause chunk. The first and last chunks belong to clause 1, and the middle chunk is clause 2.
Look what happens if we set hideTypes=True
:
A.plain(v, hideTypes=False, explain=False)
When you make the browser window narrower, the line breaks are different. Because now the verse is divided in 2 spans: one for each half verse, and the separation between the half verses is within the third clause chunk.
See it in pretty view:
A.pretty(v, explain=False)
We can selectively unhide the half verse and leave everything else hidden:
A.pretty(
v,
hideTypes=True,
hiddenTypes="subphrase phrase_atom clause_atom sentence_atom",
explain=False,
)
This shows the reason of the split.
We can also print the full structure (although that's a bit over the top):
A.pretty(v, hideTypes=False)
A.table(
((2, 213294, 426583), (3, 213295, 426582), (4, 213296, 426581)), withPassage={1, 2}
)
n | word | word | word |
---|---|---|---|
1 | Genesis 1:1 רֵאשִׁ֖ית | Isaiah 4:1 יֹּ֤ום | וְ |
2 | Genesis 1:1 בָּרָ֣א | Isaiah 4:1 הַ | עִמֹּ֖ו |
3 | Genesis 1:1 אֱלֹהִ֑ים | Isaiah 4:1 הוּא֙ | אֱלֹהָ֛יו |
Subphrases with equal slots:
w = 3461
sps = L.u(w, otype="subphrase")
for sp in sps[0:-1]:
print(E.oslots.s(sp))
A.pretty(sp, standardFeatures=True, extraFeatures="rela", withNodes=True)
array('I', [3461, 3462, 3463])
array('I', [3461, 3462, 3463])
A.pretty(v, withNodes=True, explain=False)
cl = 427612
words = L.d(cl, otype="word")
phrases = L.d(cl, otype="phrase")
highlights = {phrases[1]: "lightsalmon", words[2]: "lightblue"}
A.pretty(cl, baseTypes="phrase", withNodes=True, highlights=highlights, explain=True)
<0> TOP <1> clause 427612 {322-326} <2> phrase* 651725 {322-323} <3> word 322 {322} <3> word 323 {323} <2> phrase* 651726 {324-326} <3> word 324 {324} <3> word 325 {325} <3> word 326 {326}
c = 427931
s = L.u(c, otype="sentence")[0]
v = L.u(c, otype="verse")[0]
highlights = {c: "khaki", c + 1: "lightblue"}
A.webLink(s)
A.plain(s, withNodes=True, highlights=highlights)
A.plain(s)
T.formats
{'lex-default': 'word', 'lex-orig-full': 'word', 'lex-orig-plain': 'word', 'lex-trans-full': 'word', 'lex-trans-plain': 'word', 'text-orig-full': 'word', 'text-orig-full-ketiv': 'word', 'text-orig-plain': 'word', 'text-phono-full': 'word', 'text-trans-full': 'word', 'text-trans-full-ketiv': 'word', 'text-trans-plain': 'word'}
A.plain(c, fmt="text-phono-full", withNodes=True, explain=False)
A.plain(c, withNodes=False, explain=False)
A.pretty(c, withNodes=True, explain=False)
A.pretty(c, withNodes=True, hideTypes=False, explain=False)
A.pretty(s, withNodes=True, highlights=highlights, explain=False)
A.plain(s, withNodes=True, hideTypes=False)
A.pretty(s, withNodes=True, highlights=highlights, hideTypes=False, explain=False)
A.plain(427931)
A.pretty(427931, withNodes=True)
A.plain(427932)
A.pretty(427932)
sp = F.otype.s("subphrase")[0]
v = L.u(sp, otype="verse")[0]
A.pretty(v)
p = 653380
s = L.u(p, otype="sentence")[0]
c = L.d(s, otype="clause")[0]
A.plain(p)
A.pretty(p)
A.pretty(p, baseTypes="phrase_atom", hideTypes=True)
A.pretty(p, baseTypes="phrase")
A.plain(s)
A.plain(s, plainGaps=False)
A.plain(c, withNodes=True)
A.pretty(c)
A.pretty(s, baseTypes={"subphrase", "word"})
A.pretty(s, baseTypes="phrase")
A.prettyTuple((p,), 1, baseTypes="phrase")
result 1
A.pretty(p, baseTypes="phrase")
p = F.otype.s("phrase")[0]
pa = F.otype.s("phrase_atom")[0]
A.plain(p, highlights={p, pa})
A.plain(p, highlights={p, pa}, hideTypes=False)
A.plain(p, highlights={p})
A.plain(p, highlights={p}, hideTypes=False)
A.plain(p, highlights={pa})
A.plain(p, highlights={pa}, hideTypes=False)
A.plain(pa, highlights={p, pa})
A.plain(pa, highlights={p, pa}, hideTypes=False)
A.plain(pa, highlights={pa})
A.plain(pa, highlights={pa}, hideTypes=False)
A.plain(pa, highlights={p})
A.plain(pa, highlights={p}, hideTypes=False)
A.pretty(p, highlights={p, pa})
A.pretty(p, highlights={p, pa}, hideTypes=False)
A.pretty(p, highlights={p})
A.pretty(p, highlights={p}, hideTypes=False)
A.pretty(p, highlights={pa})
A.pretty(p, highlights={pa}, hideTypes=False)
A.pretty(pa, highlights={p, pa})
A.pretty(pa, highlights={p, pa}, hideTypes=False)
A.pretty(pa, highlights={pa})
A.pretty(pa, highlights={pa}, hideTypes=False)
A.pretty(pa, highlights={p})
A.pretty(pa, highlights={p}, hideTypes=False)
cl = 435509
ph = 675481
w = 38625
highlights = {ph, w}
A.pretty(cl, highlights=highlights, withNodes=True)
A.pretty(cl, highlights=highlights, baseTypes={"phrase"}, withNodes=True)
A.plain(ph, highlights=highlights)
A.plain(ph, highlights=highlights, baseTypes={"phrase"}, withNodes=True)