"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Loading-the-New-Testament-Text-Fabric (add a specific version, eg. 0.1.2)\n",
"NA = use (\"tonyjurg/n1904_lft\", version=\"0.1.6\", hoist=globals())"
]
},
{
"cell_type": "code",
"execution_count": 128,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'word': 0, 'wg': 1, 'sentence': 2, 'verse': 3, 'chapter': 4, 'book': 5}"
]
},
"execution_count": 128,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N.otypeRank\n"
]
},
{
"cell_type": "code",
"execution_count": 168,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'text-orig-full': 'word'}"
]
},
"execution_count": 168,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"T.formats"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 2 Perform some basic display \n",
"\n",
"note: the implementation with regards how phrases need to be displayed (esp. with regards to conjunctions) is still to be done."
]
},
{
"cell_type": "code",
"execution_count": 184,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.01s 25 results\n"
]
},
{
"data": {
"text/html": [
"verse 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"verse 1
sentence
wg
wg P2CL Verbless
wg NPofNP Predicate
Βίβλος
gloss=[The] booksp=noun
wg NPofNP
γενέσεως
gloss=of [the] genealogysp=noun
wg Np-Appos
wg Np-Appos
wg Np-Appos
Ἰησοῦ
gloss=of Jesussp=noun
Χριστοῦ
gloss=Christsp=noun
wg NPofNP apposition
Δαυεὶδ
gloss=of Davidsp=noun
wg NPofNP apposition
Ἀβραάμ.
gloss=of Abrahamsp=noun
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"verse 2"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"verse 2
sentence
wg
wg Conj13CL
wg S-V-O coordinate
Ἀβραὰμ
gloss=Abrahamsp=nounwordrolelong=Subject
ἐγέννησεν
gloss=begatsp=verbwordrolelong=Verbal
wg
wg S-V-O coordinate
Ἰσαὰκ
gloss=Isaacsp=nounwordrolelong=Subject
wg S-V-O coordinate
ἐγέννησεν
gloss=begatsp=verbwordrolelong=Verbal
wg
wg S-V-O coordinate
Ἰακὼβ
gloss=Jacobsp=nounwordrolelong=Subject
wg S-V-O coordinate
ἐγέννησεν
gloss=begatsp=verbwordrolelong=Verbal
wg NpaNp Object
wg DetNP
Ἰούδαν
gloss=Judahsp=noun
wg
wg DetNP
wg NPofNP
ἀδελφοὺς
gloss=brotherssp=noun
αὐτοῦ,
gloss=of himsp=pron
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"Search0 = '''\n",
"book book=Matthew\n",
" chapter chapter=1\n",
" \n",
" verse \n",
"'''\n",
"Search0 = NA.search(Search0)\n",
"NA.show(Search0, start=1, end=2, condensed=True, extraFeatures={'sp','gloss','wordrolelong'}, suppress={'chapter'}, withNodes=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 3 dump some structure information"
]
},
{
"cell_type": "code",
"execution_count": 132,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A heading is a tuple of pairs (node type, feature value)\n",
"\tof node types and features that have been configured as structural elements\n",
"These 3 structural elements have been configured\n",
"\tnode type book with heading feature book\n",
"\tnode type chapter with heading feature chapter\n",
"\tnode type verse with heading feature verse\n",
"You can get them as a tuple with T.headings.\n",
"\n",
"Structure API:\n",
"\tT.structure(node=None) gives the structure below node, or everything if node is None\n",
"\tT.structurePretty(node=None) prints the structure below node, or everything if node is None\n",
"\tT.top() gives all top-level nodes\n",
"\tT.up(node) gives the (immediate) parent node\n",
"\tT.down(node) gives the (immediate) children nodes\n",
"\tT.headingFromNode(node) gives the heading of a node\n",
"\tT.nodeFromHeading(heading) gives the node of a heading\n",
"\tT.ndFromHd complete mapping from headings to nodes\n",
"\tT.hdFromNd complete mapping from nodes to headings\n",
"\tT.hdMult are all headings with their nodes that occur multiple times\n",
"\n",
"There are 8230 structural elements in the dataset.\n",
"\n"
]
}
],
"source": [
"T.structureInfo()"
]
},
{
"cell_type": "code",
"execution_count": 133,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'Availability': 'Creative Commons Attribution 4.0 International (CC BY 4.0)',\n",
" 'Converter_author': 'Tony Jurg, Vrije Universiteit Amsterdam, Netherlands',\n",
" 'Converter_execution': 'Tony Jurg, Vrije Universiteit Amsterdam, Netherlands',\n",
" 'Converter_version': '0.1.6 (moved all phrases and claused to wordgroup nodes)',\n",
" 'Convertor_source': 'https://github.com/tonyjurg/n1904_lft',\n",
" 'Data source': 'MACULA Greek Linguistic Datasets, available at https://github.com/Clear-Bible/macula-greek/tree/main/Nestle1904/lowfat',\n",
" 'Editors': 'Nestle',\n",
" 'Name': 'Greek New Testament (NA1904)',\n",
" 'TextFabric version': '11.2.3',\n",
" 'Version': '1904',\n",
" 'fmt:text-orig-full': '{word}{after}',\n",
" 'sectionFeatures': 'book,chapter,verse',\n",
" 'sectionTypes': 'book,chapter,verse',\n",
" 'structureFeatures': 'book,chapter,verse',\n",
" 'structureTypes': 'book,chapter,verse',\n",
" 'writtenBy': 'Text-Fabric',\n",
" 'dateWritten': '2023-05-02T15:20:37Z'}"
]
},
"execution_count": 133,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"TF.features['otext'].metaData\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Running text fabric browser \n",
"##### [back to TOC](#TOC)"
]
},
{
"cell_type": "code",
"execution_count": 134,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"^C\n"
]
}
],
"source": [
"!text-fabric app "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!text-fabric app -k"
]
},
{
"cell_type": "code",
"execution_count": 135,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'tf' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"Input \u001b[1;32mIn [135]\u001b[0m, in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mtf\u001b[49m\u001b[38;5;241m.\u001b[39mcore\u001b[38;5;241m.\u001b[39mnodes\u001b[38;5;241m.\u001b[39mNodes\u001b[38;5;241m.\u001b[39motypeRank\n",
"\u001b[1;31mNameError\u001b[0m: name 'tf' is not defined"
]
}
],
"source": [
"tf.core.nodes.Nodes.otypeRank"
]
},
{
"cell_type": "code",
"execution_count": null,
"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"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": true,
"toc_position": {
"height": "calc(100% - 180px)",
"left": "10px",
"top": "150px",
"width": "321.391px"
},
"toc_section_display": true,
"toc_window_display": true
}
},
"nbformat": 4,
"nbformat_minor": 4
}
|