{ "cells": [ { "cell_type": "markdown", "id": "93db94f1-9db3-43eb-9b18-4203d6796234", "metadata": { "tags": [] }, "source": [ "# Print a specific verse (Nestle1904GBI)" ] }, { "cell_type": "markdown", "id": "688c25d7-0277-4fe3-9d7f-dee0b81ee07c", "metadata": {}, "source": [ "## Table of content \n", "* 1 - Introduction\n", "* 2 - Load Text-Fabric app and data\n", "* 3 - Performing the queries\n", " * 3.1 - Show all object phrases in clauses\n", " * 3.2 - Selecting individual words of the verse\n", " * 3.3 - Available output formats\n", "* 4 - Attribution and footnotes\n", "* 5 - Required libraries" ] }, { "cell_type": "markdown", "id": "8d234f24-515f-430c-a7ce-709e18605a01", "metadata": { "tags": [] }, "source": [ "# 1 - Introduction \n", "##### [Back to TOC](#TOC)\n", "\n", "This Jupyter Notebook shows the method of selecting a specific verse from the Greek New Testament corpus for display or further processing. " ] }, { "cell_type": "markdown", "id": "1841c53f-ba52-4c6e-ab0b-8ecefee86fb2", "metadata": {}, "source": [ "# 2 - Load Text-Fabric app and data \n", "##### [Back to TOC](#TOC)" ] }, { "cell_type": "code", "execution_count": 2, "id": "b3511ace-56ae-485f-ad9c-43e0b84728c5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The autoreload extension is already loaded. To reload it, use:\n", " %reload_ext autoreload\n" ] } ], "source": [ "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "code", "execution_count": 3, "id": "756ac563-3d0b-4a31-9d62-604d21a6a909", "metadata": {}, "outputs": [], "source": [ "# Loading the Text-Fabric code\n", "# Note: it is assumed Text-Fabric is installed in your environment\n", "from tf.fabric import Fabric\n", "from tf.app import use" ] }, { "cell_type": "code", "execution_count": 4, "id": "4eb44182-0825-453c-b254-9ea6a83b44ad", "metadata": { "scrolled": true, "tags": [] }, "outputs": [ { "data": { "text/markdown": [ "**Locating corpus resources ...**" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "app: ~/text-fabric-data/github/tonyjurg/Nestle1904GBI/app" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "data: ~/text-fabric-data/github/tonyjurg/Nestle1904GBI/tf/0.4" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " TF: TF API 12.2.2, tonyjurg/Nestle1904GBI/app v3, Search Reference
\n", " Data: tonyjurg - Nestle1904GBI 0.4, Character table, Feature docs
\n", "
Node types\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", "
Name# of nodes# slots / node% coverage
book275102.93100
chapter260529.92100
sentence572024.09100
verse794317.35100
clause161248.54100
phrase726741.90100
word1377791.00100
\n", " Sets: no custom sets
\n", " Features:
\n", "
Nestle 1904 (GBI nodes)\n", "
\n", "\n", "
\n", "
\n", "after\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "book\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "booknum\n", "
\n", "
int
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "bookshort\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "case\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "chapter\n", "
\n", "
int
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "clause\n", "
\n", "
int
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "clauserule\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "clausetype\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "degree\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "formaltag\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "functionaltag\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "gloss\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "gn\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "lemma\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "lex_dom\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "ln\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "monad\n", "
\n", "
int
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "mood\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "nodeID\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "normalized\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "nu\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "number\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "otype\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "person\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "phrase\n", "
\n", "
int
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "phrasefunction\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "phrasefunctionlong\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "phrasetype\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "sentence\n", "
\n", "
int
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "sp\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "splong\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "strongs\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "subj_ref\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "tense\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "type\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "verse\n", "
\n", "
int
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "voice\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "word\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "oslots\n", "
\n", "
none
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "\n", " Settings:
specified
  1. apiVersion: 3
  2. appName: tonyjurg/Nestle1904GBI
  3. appPath:C:/Users/tonyj/text-fabric-data/github/tonyjurg/Nestle1904GBI/app
  4. commit: 671c7903caf2cdaa57866014bc3915a2840d4646
  5. css:
  6. dataDisplay:
    • excludedFeatures: [reference]
    • noneValues:
      • none
      • unknown
      • no value
      • NA
      • ''
  7. interfaceDefaults: {fmt: layout-orig-full}
  8. isCompatible: True
  9. local: local
  10. localDir:C:/Users/tonyj/text-fabric-data/github/tonyjurg/Nestle1904GBI/_temp
  11. provenanceSpec:
    • corpus: Nestle 1904 (GBI nodes)
    • org: tonyjurg
    • relative: /tf
    • repo: Nestle1904GBI
    • repro: Nestle1904GBI
    • version: 0.4
    • webUrl:https://bibleol.3bmoodle.dk/text/show_text/nestle1904/<1>/<2>/<3>
  12. release: 0.4
  13. typeDisplay:
    • book:
      • label: {book}
      • style: ''
    • clause:
      • label: #{clause}
      • style: ''
    • phrase:
      • label: #{phrase}
      • style: ''
    • word:
      • features:
        • lemma
        • strongs
      • featuresBare: [gloss]
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
TF API: names N F E L T S C TF Fs Fall Es Eall Cs Call directly usable

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# load the N1904 app and data\n", "N1904 = use (\"tonyjurg/Nestle1904GBI\", version=\"0.4\", hoist=globals())" ] }, { "cell_type": "code", "execution_count": 5, "id": "9902ea32-d94b-4ddb-98f0-5c2a0487c5a8", "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# The following will push the Text-Fabric stylesheet to this notebook (to facilitate proper display with notebook viewer)\n", "N1904.dh(N1904.getCss())" ] }, { "cell_type": "markdown", "id": "a29a3dc3-f727-458d-b90b-bee8e4545859", "metadata": {}, "source": [ "# 3 - Performing the queries \n", "##### [Back to TOC](#TOC)" ] }, { "cell_type": "markdown", "id": "e5f5ec0c-c754-4d5a-9cb6-3b6249859ea1", "metadata": { "tags": [] }, "source": [ "## 3.1 - Show a specific verse\n", "##### [Back to TOC](#TOC)\n", "\n", "The following example will query for a specific verte (i.e. Matthew 1:8). As expected, the query yealds one result." ] }, { "cell_type": "code", "execution_count": 6, "id": "7a6b5c40-7a4f-4a8e-bc8c-363c9691c40e", "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.01s 1 result\n" ] }, { "data": { "text/html": [ "

verse 1" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

verse
book=Matthewchapter=1verse=8
clause #19
book=Matthewchapter=1clauserule=S-V-Overse=8
phrase #57
phrasefunction=S
Ἀσὰφ
book=Matthewchapter=1sp=nounverse=8
δὲ
book=Matthewchapter=1sp=conjverse=8
phrase #58
phrasefunction=V
ἐγέννησεν
book=Matthewchapter=1sp=verbverse=8
phrase #59
phrasefunction=O
τὸν
book=Matthewchapter=1sp=detverse=8
Ἰωσαφάτ,
book=Matthewchapter=1sp=nounverse=8
clause #20
book=Matthewchapter=1clauserule=S-V-Overse=8
phrase #60
phrasefunction=S
Ἰωσαφὰτ
book=Matthewchapter=1sp=nounverse=8
δὲ
book=Matthewchapter=1sp=conjverse=8
phrase #61
phrasefunction=V
ἐγέννησεν
book=Matthewchapter=1sp=verbverse=8
phrase #62
phrasefunction=O
τὸν
book=Matthewchapter=1sp=detverse=8
Ἰωράμ,
book=Matthewchapter=1sp=nounverse=8
clause #21
book=Matthewchapter=1clauserule=S-V-Overse=9
phrase #63
phrasefunction=S
Ἰωρὰμ
book=Matthewchapter=1sp=nounverse=8
δὲ
book=Matthewchapter=1sp=conjverse=8
phrase #64
phrasefunction=V
ἐγέννησεν
book=Matthewchapter=1sp=verbverse=8
phrase #65
phrasefunction=O
τὸν
book=Matthewchapter=1sp=detverse=8
Ὀζείαν,
book=Matthewchapter=1sp=nounverse=8
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Define the query template\n", "VerseQuery = '''\n", "book book=Matthew\n", " chapter chapter=1\n", " verse verse=8\n", "'''\n", "\n", "# The following will create a list containing ordered tuples consisting of node numbers of the items as they appear in the query\n", "VerseResult = N1904.search(VerseQuery)\n", "\n", "# Print some of the results\n", "N1904.show(VerseResult, start=1, end=2, condensed=True, extraFeatures={'sp', 'clauserule', 'phrasefunction'}, multiFeatures=False)" ] }, { "cell_type": "markdown", "id": "7f66a197-eab6-4f31-98c4-31161317ea96", "metadata": {}, "source": [ "## 3.2 - Selecting individual words of the verse \n", "##### [Back to TOC](#TOC)" ] }, { "cell_type": "markdown", "id": "085fba5d-f0c4-4214-b6b3-b8381861e6d3", "metadata": {}, "source": [ "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." ] }, { "cell_type": "code", "execution_count": 7, "id": "5bb83121-10cc-4430-95af-a558c5a5cc21", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.09s 15 results\n" ] }, { "data": { "text/html": [ "

verse 1" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

verse
book=Matthewchapter=1verse=8
clause #19
book=Matthewchapter=1verse=8
phrase #57
Ἀσὰφ
book=Matthewchapter=1verse=8
δὲ
book=Matthewchapter=1verse=8
phrase #58
ἐγέννησεν
book=Matthewchapter=1verse=8
phrase #59
τὸν
book=Matthewchapter=1verse=8
Ἰωσαφάτ,
book=Matthewchapter=1verse=8
clause #20
book=Matthewchapter=1verse=8
phrase #60
Ἰωσαφὰτ
book=Matthewchapter=1verse=8
δὲ
book=Matthewchapter=1verse=8
phrase #61
ἐγέννησεν
book=Matthewchapter=1verse=8
phrase #62
τὸν
book=Matthewchapter=1verse=8
Ἰωράμ,
book=Matthewchapter=1verse=8
clause #21
book=Matthewchapter=1verse=9
phrase #63
Ἰωρὰμ
book=Matthewchapter=1verse=8
δὲ
book=Matthewchapter=1verse=8
phrase #64
ἐγέννησεν
book=Matthewchapter=1verse=8
phrase #65
τὸν
book=Matthewchapter=1verse=8
Ὀζείαν,
book=Matthewchapter=1verse=8
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Define the query template\n", "AltVerseQuery = '''\n", "word book=Matthew chapter=1 verse=8\n", "'''\n", "\n", "# The following will create a list containing ordered tuples consisting of node numbers of the items as they appear in the query\n", "AltVerseResult = N1904.search(AltVerseQuery)\n", "\n", "# Print some of the results\n", "N1904.show(AltVerseResult, start=1, end=15, condensed=True, multiFeatures=False)" ] }, { "cell_type": "markdown", "id": "a5583155-be42-4577-a88d-788c24a0b8d9", "metadata": {}, "source": [ "## 3.3 - Available output formats \n", "##### [Back to TOC](#TOC)\n", "\n", "To check the available formats to display the text:" ] }, { "cell_type": "code", "execution_count": 8, "id": "b963ca04-3c61-45e1-943b-6649885218b2", "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "format | level | template\n", "--- | --- | ---\n", "`text-orig-full` | **word** | `{word}{after}`\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "N1904.showFormats()" ] }, { "cell_type": "markdown", "id": "2981185e-7e93-4ed1-998b-16830cc712d3", "metadata": {}, "source": [ "The same result (although formatted different, since an ordered tuple is returned) can be obtained by the following call:" ] }, { "cell_type": "code", "execution_count": 9, "id": "30ffd6f5-a293-4edb-b4f9-d58927db5b14", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'text-orig-full': 'word'}" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "T.formats" ] }, { "cell_type": "markdown", "id": "f8fe7723-e643-4f39-b368-c6c16ab56e61", "metadata": {}, "source": [ "Note that this data originates from file `otext.tf`:\n", "\n", "> \n", "```\n", "@config\n", "...\n", "@fmt:text-orig-full={word}{after}\n", "...\n", "```\n" ] }, { "cell_type": "markdown", "id": "1d364cff-1b7e-42d0-aa32-cbf6e0ff1537", "metadata": {}, "source": [ "# 4 - Attribution and footnotes\n", "##### [Back to TOC](#TOC)\n", "\n", "N.A." ] }, { "cell_type": "markdown", "id": "1aed70bc-570b-4175-a094-ef2d86b15334", "metadata": {}, "source": [ "# 5 - Required libraries \n", "##### [Back to TOC](#TOC)\n", "\n", "The scripts in this notebook require (beside `text-fabric`) the following Python libraries to be installed in the environment:\n", "\n", " {none}\n", "\n", "You can install any missing library from within Jupyter Notebook using either`pip` or `pip3`." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.5" } }, "nbformat": 4, "nbformat_minor": 5 }