{ "cells": [ { "cell_type": "markdown", "id": "bec25f1a", "metadata": {}, "source": [ "# Loading Text-Fabric (Nestle1904 GBI nodes)\n", "\n", "Basic instructions on loading the Text-Fabric and start using it on your system." ] }, { "cell_type": "markdown", "id": "fa7f85d5", "metadata": {}, "source": [ "## Table of content \n", " \n", "### Loading program and dataset\n", "* [Step 1: Install Text-Fabric (if not yet installed)](#first-bullet)\n", "* [Step 2: Raise rate limit on Github](#second-bullet)\n", "* [Step 3: Load Text Fabric code](#third-bullet)\n", "* [Step 4: Load app and data](#fourth-bullet)\n", " \n", "### Some basic usage example\n", "[Example 1: show all object phrases in clauses](#fifth-bullet)" ] }, { "cell_type": "markdown", "id": "d5a6e05a", "metadata": {}, "source": [ "## Loading program and dataset\n", "\n", "### Step 1: Install Text-Fabric (if not yet installed) \n", "##### [back to TOC](#TOC)" ] }, { "cell_type": "markdown", "id": "f71d3a83", "metadata": {}, "source": [ "#### Python\n", "\n", "You need to have Python on your system. Most systems have it out of the box,\n", "but alas, that is python2 and we need at least python **3.6**.\n", "\n", "Install it from [python.org](https://www.python.org) or from\n", "[Anaconda](https://www.anaconda.com/products/distribution).\n", "\n", "#### TF itself\n", "\n", "```\n", "pip3 install text-fabric\n", "```\n", "\n", "#### When using Jupyter notebook\n", "\n", "You need [Jupyter](http://jupyter.org) or a platform like [Anaconda](https://www.anaconda.com/products/distribution) which includes Jupyter.\n", "\n", "If it is not already installed:\n", "\n", "```\n", "pip3 install jupyter\n", "```" ] }, { "cell_type": "markdown", "id": "8684bf30", "metadata": {}, "source": [ "### Step 2: Raise rate limit on Github \n", "##### [back to TOC](#TOC)\n", "\n", "It may be required to increase rate limit for GitHub. [See instructions](https://annotation.github.io/text-fabric/tf/advanced/repo.html) on aquiring and setting the GHPERS variable. \n", "See [here](https://www.howtogeek.com/789660/how-to-use-windows-cmd-environment-variables/#autotoc_anchor_2) if you want to set the varibale on windows using the command prompt." ] }, { "cell_type": "markdown", "id": "edadeba4", "metadata": {}, "source": [ "### Step 3: Load TextFabric code \n", "##### [back to TOC](#TOC)" ] }, { "cell_type": "code", "execution_count": 1, "id": "a5bc2a5d", "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "code", "execution_count": 2, "id": "31f3bbde", "metadata": {}, "outputs": [], "source": [ "# Loading the New Testament TextFabric code\n", "\n", "from tf.fabric import Fabric\n", "from tf.app import use" ] }, { "cell_type": "markdown", "id": "f8a57edd-2c89-406a-873f-e7f71a5539c3", "metadata": {}, "source": [ "### Step 4: Load app and data \n", "##### [back to TOC](#TOC)" ] }, { "cell_type": "code", "execution_count": 3, "id": "b8574f48", "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "**Locating corpus resources ...**" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "The requested app is not available offline\n", "\t~/text-fabric-data/github/tonyjurg/Nestle1904GBI/app not found\n" ] }, { "data": { "text/html": [ "Status: latest release online v0.1.1 versus None locally" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "downloading app, main data and requested additions ..." ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stderr", "output_type": "stream", "text": [ "File is not a zip file\n", "\tcould not save corpus data to ~/text-fabric-data/github" ] }, { "name": "stdout", "output_type": "stream", "text": [ "rate limit is 5000 requests per hour, with 4993 left for this hour\n", "\tconnecting to online GitHub repo tonyjurg/Nestle1904GBI ... connected\n", "\tapp/README.md...downloaded\n", "\tapp/config.yaml...downloaded\n", "\tapp/static...directory\n", "\t\tapp/static/display.css...downloaded\n", "\tOK\n" ] }, { "data": { "text/html": [ "app: ~/text-fabric-data/github/tonyjurg/Nestle1904GBI/app" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "The requested data is not available offline\n", "\t~/text-fabric-data/github/tonyjurg/Nestle1904GBI/tf/1904 not found\n" ] }, { "data": { "text/html": [ "Status: latest release online v0.1.1 versus None locally" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "downloading app, main data and requested additions ..." ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stderr", "output_type": "stream", "text": [ "File is not a zip file\n", "\tcould not save corpus data to ~/text-fabric-data/github" ] }, { "name": "stdout", "output_type": "stream", "text": [ "rate limit is 5000 requests per hour, with 4978 left for this hour\n", "\tconnecting to online GitHub repo tonyjurg/Nestle1904GBI ... connected\n", "No directory /tf/1904 in #af5dd4a4b6ea90e435d1caee5b8a8648e48a62b9Will try something else\n", "\tFailed\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "No directory /tf/1904 in #4b7b74b85283250f048b4fcbafbb00ce48da25e1\tFailed\n", "There were problems with loading data.\n", "The Text-Fabric API has not been loaded!\n", "The app \"tonyjurg/Nestle1904GBI\" will not work!\n" ] } ], "source": [ "# load the app and data\n", "NA = use (\"tonyjurg/Nestle1904GBI\", hoist=globals())" ] }, { "cell_type": "markdown", "id": "63ab413a", "metadata": {}, "source": [ "# Some basic usage example\n", "##### [back to TOC](#TOC)\n", "\n", "### Example 1: show all object phrases in clauses\n", "\n", "The following example will query (and indicate) the phrases with function 'O' (=Object). This is done by selecting versed containing the value 'O' for feature 'phrasefunction' belonging to node type 'phrase'. See also the [feature description of 'phrasefunction'](https://tonyjurg.github.io/Nestle1904GBI/features/phrasefunction.html)." ] }, { "cell_type": "code", "execution_count": 16, "id": "adc48de9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.05s 51 results\n" ] }, { "data": { "text/html": [ "

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

verse
clause #2
clausetype=S-V-O
phrase #2
phrasefunction=S
Ἀβραὰμ
sp=noun
phrase #3
phrasefunction=V
ἐγέννησεν
sp=verb
phrase #4
phrasefunction=O
τὸν
sp=det
Ἰσαάκ,
sp=noun
clause #3
clausetype=S-V-O
phrase #5
phrasefunction=S
Ἰσαὰκ
sp=noun
δὲ
sp=conj
phrase #6
phrasefunction=V
ἐγέννησεν
sp=verb
phrase #7
phrasefunction=O
τὸν
sp=det
Ἰακώβ,
sp=noun
clause #4
clausetype=S-V-O-ADV
phrase #8
phrasefunction=S
Ἰακὼβ
sp=noun
δὲ
sp=conj
phrase #9
phrasefunction=V
ἐγέννησεν
sp=verb
phrase #10
phrasefunction=O
τὸν
sp=det
Ἰούδαν
sp=noun
καὶ
sp=conj
τοὺς
sp=det
ἀδελφοὺς
sp=noun
αὐτοῦ,
sp=pron
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

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

verse
clause #5
clausetype=S-V-O
phrase #11
phrasefunction=S
Ἰούδας
sp=noun
δὲ
sp=conj
phrase #12
phrasefunction=V
ἐγέννησεν
sp=verb
phrase #13
phrasefunction=O
τὸν
sp=det
Φαρὲς
sp=noun
καὶ
sp=conj
τὸν
sp=det
Ζαρὰ
sp=noun
phrase #14
phrasefunction=ADV
ἐκ
sp=prep
τῆς
sp=det
Θάμαρ,
sp=noun
clause #6
clausetype=S-V-O
phrase #15
phrasefunction=S
Φαρὲς
sp=noun
δὲ
sp=conj
phrase #16
phrasefunction=V
ἐγέννησεν
sp=verb
phrase #17
phrasefunction=O
τὸν
sp=det
Ἐσρώμ,
sp=noun
clause #7
clausetype=S-V-O
phrase #18
phrasefunction=S
Ἐσρὼμ
sp=noun
δὲ
sp=conj
phrase #19
phrasefunction=V
ἐγέννησεν
sp=verb
phrase #20
phrasefunction=O
τὸν
sp=det
Ἀράμ,
sp=noun
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "Search0 = '''\n", "book book=Matthew\n", " chapter chapter=1\n", " phrase phrasefunction=O\n", "'''\n", "Search0 = NA.search(Search0)\n", "NA.show(Search0, start=1, end=2, condensed=True, extraFeatures={'sp', 'clausetype'}, suppress={'chapter'}, colorMap={4:'pink', 5:'turquoise', 6:'lightblue', 7:'red'}, multiFeatures=False)" ] }, { "cell_type": "code", "execution_count": null, "id": "67c0b9e1", "metadata": {}, "outputs": [], "source": [] } ], "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.9.12" } }, "nbformat": 4, "nbformat_minor": 5 }