Text-Fabric Api 활용예제 2


In [1]:
from tf.fabric import Fabric

ETCBC = 'hebrew/etcbc4c'
PHONO = 'hebrew/phono'
TF = Fabric( modules=[ETCBC, PHONO], silent=False )

api = TF.load('''
    book chapter verse
    sp nu gn ps vt vs st
    otype
    det
    g_word_utf8 trailer_utf8
    lex_utf8 lex voc_utf8
    g_prs_utf8 g_uvf_utf8
    prs_gn prs_nu prs_ps g_cons_utf8
    gloss 
''')


This is Text-Fabric 2.3.7
Api reference : https://github.com/ETCBC/text-fabric/wiki/Api
Tutorial      : https://github.com/ETCBC/text-fabric/blob/master/docs/tutorial.ipynb
Data sources  : https://github.com/ETCBC/text-fabric-data
Data docs     : https://etcbc.github.io/text-fabric-data
Shebanq docs  : https://shebanq.ancient-data.org/text
Slack team    : https://shebanq.slack.com/signup
Questions? Ask shebanq@ancient-data.org for an invite to Slack
111 features found and 0 ignored
  0.00s loading features ...
   |     0.02s B otype                from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.00s B book                 from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.00s B chapter              from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.00s B verse                from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.14s B g_cons_utf8          from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.15s B g_word_utf8          from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.13s B lex_utf8             from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.06s B trailer_utf8         from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.08s B sp                   from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.08s B nu                   from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.07s B gn                   from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.08s B ps                   from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.08s B vt                   from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.08s B vs                   from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.07s B st                   from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.10s B det                  from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.09s B lex                  from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.00s B voc_utf8             from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.06s B g_prs_utf8           from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.05s B g_uvf_utf8           from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.09s B prs_gn               from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.09s B prs_nu               from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.09s B prs_ps               from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.00s B gloss                from /home/kungsik/github/text-fabric-data/hebrew/etcbc4c
   |     0.00s Feature overview: 104 for nodes; 5 for edges; 2 configs; 7 computed
  4.68s All features loaded/computed - for details use loadLog()

In [2]:
api.makeAvailableIn(globals())

창세기 1:1의 node 값을 출력. 아래는 히브리어 텍스트로 출력


In [3]:
verseNode = T.nodeFromSection(('Genesis', 1, 1))
wordsNode = L.d(verseNode, otype='word')
print(wordsNode)


[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]

In [4]:
print(T.text(wordsNode))


בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ 

창세기 1:1의 두번째 node(두번째 단어)의 히브리어 자음 값을 불러옴


In [5]:
print(F.g_cons_utf8.v(wordsNode[1]))


ראשׁית

창세기 1:1의 두번째 node의 의미(gloss) 값을 불러옴


In [6]:
print(F.gloss.v(L.u(wordsNode[1], otype='lex')[0]))


beginning

창세기 책 전체 node를 선택하고 마지막 슬롯의 텍스트 범위를 불러옴.


In [7]:
chpNode = T.nodeFromSection(('Genesis',))
l_ref = T.sectionFromNode(chpNode, lastSlot=True)
print(l_ref)


('Genesis', 50, 26)

아무런 참조값을 주지 않으면 첫번째 슬롯을 불러옴.


In [8]:
f_ref = T.sectionFromNode(chpNode)
print(f_ref)


('Genesis', 1, 1)

In [ ]: