{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "\n", "# Steps\n", "\n", "The transliterations in the Uruk corpus are a kind of landscape.\n", "In this notebook we take our first steps around." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Landscape\n", "\n", "The transcriptions of the tablets in their TF form is organized in a model of nodes, edges and features.\n", "\n", "The things such as tablets, faces, columns, lines, cases, and, at the most basic level, signs, are numbered.\n", "The signs correspond to number 1 ... 100,000+, in the same order as they occur in the corpus.\n", "All other things are built from signs. They have higher numbers.\n", "\n", "In TF, we call these numbers *nodes*.\n", "Like a bar code, this number gives access to a whole bunch of\n", "information about the corresponding object.\n", "\n", "For example, cases have a property (in TF we call it a *feature*) called `number`.\n", "It contains the hierarchical number of a case within a line, based on the\n", "numbers at the start of the transcription lines.\n", "\n", "If the node (bar code) for a case is `n`, we can find its hierarchical number by saying\n", "\n", "```\n", "F.number.v(n)\n", "```\n", "\n", "In words, it reads as:\n", "\n", "* `F`: I want to look up a Feature\n", "* `number`: the name of the feature\n", "* `.v`: I want the value of that feature\n", "* `(n)`: for the given node `n`\n", "\n", "Seen in this way, the data is like a gigantic spreadsheet of hundreds of thousands of rows (the nodes),\n", "and a few dozen columns (the features).\n", "\n", "There is a bit more to it, since the nodes can be grouped together in ways we will see later on.\n", "\n", "The complete reference information is in the\n", "[Feature docs](https://github.com/Nino-cunei/uruk/blob/master/docs/transcription.md)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Incantation\n", "\n", "We start the notebook by the familiar incantation." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2018-05-11T09:57:30.686430Z", "start_time": "2018-05-11T09:57:30.663582Z" } }, "outputs": [], "source": [ "from tf.app import use" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2018-05-11T09:57:32.625641Z", "start_time": "2018-05-11T09:57:31.340095Z" } }, "outputs": [ { "data": { "text/markdown": [ "**Locating corpus resources ...**" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "app: ~/text-fabric-data/github/Nino-cunei/uruk/app" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "data: ~/text-fabric-data/github/Nino-cunei/uruk/tf/1.0" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " Text-Fabric: Text-Fabric API 11.3.0, Nino-cunei/uruk/app v3, Search Reference
\n", " Data: Nino-cunei - uruk 1.0, 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", "\n", "\n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", "
Name# of nodes# slots/node% coverage
tablet636422.01100
face945614.1095
column140239.3493
line358423.6192
case96513.4624
cluster327531.0324
quad37942.056
comment110901.008
sign1400941.00100
\n", " Sets: no custom sets
\n", " Features:
\n", "
Uruk IV/III: Proto-cuneiform tablets \n", "
\n", "\n", "
\n", "
\n", "catalogId\n", "
\n", "
str
\n", "\n", " identifier of tablet in catalog (http://www.flutopedia.com/tablets.htm)\n", "\n", "
\n", "\n", "
\n", "
\n", "crossref\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "damage\n", "
\n", "
int
\n", "\n", " indicates damage of signs or quads,corresponds to #-flag in transcription\n", "\n", "
\n", "\n", "
\n", "
\n", "depth\n", "
\n", "
int
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "excavation\n", "
\n", "
str
\n", "\n", " excavation number of tablet\n", "\n", "
\n", "\n", "
\n", "
\n", "fragment\n", "
\n", "
str
\n", "\n", " level between tablet and face\n", "\n", "
\n", "\n", "
\n", "
\n", "fullNumber\n", "
\n", "
str
\n", "\n", " the combination of face type and column number on columns\n", "\n", "
\n", "\n", "
\n", "
\n", "grapheme\n", "
\n", "
str
\n", "\n", " name of a grapheme (glyph)\n", "\n", "
\n", "\n", "
\n", "
\n", "identifier\n", "
\n", "
str
\n", "\n", " additional information pertaining to the name of a face\n", "\n", "
\n", "\n", "
\n", "
\n", "modifier\n", "
\n", "
str
\n", "\n", " indicates modifcation of a sign; corresponds to sign@letter in transcription. if the grapheme is a repeat, the modification applies to the whole repeat.\n", "\n", "
\n", "\n", "
\n", "
\n", "modifierFirst\n", "
\n", "
str
\n", "\n", " indicates the order between modifiers and variants on the same object; if 1, modifiers come before variants\n", "\n", "
\n", "\n", "
\n", "
\n", "modifierInner\n", "
\n", "
str
\n", "\n", " indicates modifcation of a sign within a repeatcorresponds to sign@letter in transcription\n", "\n", "
\n", "\n", "
\n", "
\n", "name\n", "
\n", "
str
\n", "\n", " name of tablet\n", "\n", "
\n", "\n", "
\n", "
\n", "number\n", "
\n", "
str
\n", "\n", " number of a column or line or case\n", "\n", "
\n", "\n", "
\n", "
\n", "otype\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "period\n", "
\n", "
str
\n", "\n", " period that characterises the tablet corpus\n", "\n", "
\n", "\n", "
\n", "
\n", "prime\n", "
\n", "
int
\n", "\n", " indicates the presence/multiplicity of a prime (single quote)\n", "\n", "
\n", "\n", "
\n", "
\n", "remarkable\n", "
\n", "
int
\n", "\n", " corresponds to ! flag in transcription \n", "\n", "
\n", "\n", "
\n", "
\n", "repeat\n", "
\n", "
int
\n", "\n", " number indicating the number of repeats of a grapheme,especially in numerals; -1 comes from repeat N in transcription\n", "\n", "
\n", "\n", "
\n", "
\n", "srcLn\n", "
\n", "
str
\n", "\n", " transcribed line\n", "\n", "
\n", "\n", "
\n", "
\n", "srcLnNum\n", "
\n", "
int
\n", "\n", " line number in transcription file\n", "\n", "
\n", "\n", "
\n", "
\n", "terminal\n", "
\n", "
str
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "text\n", "
\n", "
str
\n", "\n", " text of comment nodes\n", "\n", "
\n", "\n", "
\n", "
\n", "type\n", "
\n", "
str
\n", "\n", " type of a face; type of a comment; type of a cluster;type of a sign\n", "\n", "
\n", "\n", "
\n", "
\n", "uncertain\n", "
\n", "
int
\n", "\n", " corresponds to ?-flag in transcription\n", "\n", "
\n", "\n", "
\n", "
\n", "variant\n", "
\n", "
str
\n", "\n", " allograph for a sign, corresponds to ~x in transcription\n", "\n", "
\n", "\n", "
\n", "
\n", "variantOuter\n", "
\n", "
str
\n", "\n", " allograph for a quad, corresponds to ~x in transcription\n", "\n", "
\n", "\n", "
\n", "
\n", "written\n", "
\n", "
str
\n", "\n", " corresponds to !(xxx) flag in transcription\n", "\n", "
\n", "\n", "
\n", "
\n", "comments\n", "
\n", "
none
\n", "\n", " links comment nodes to their targets\n", "\n", "
\n", "\n", "
\n", "
\n", "op\n", "
\n", "
str
\n", "\n", " operator connecting left to right operand in a quad\n", "\n", "
\n", "\n", "
\n", "
\n", "oslots\n", "
\n", "
none
\n", "\n", " \n", "\n", "
\n", "\n", "
\n", "
\n", "sub\n", "
\n", "
none
\n", "\n", " connects line or case with sub-cases, quad with sub-quads; clusters with sub-clusters\n", "\n", "
\n", "\n", "
\n", "
\n", "\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": [ "
Text-Fabric API: names N F E L T S C TF directly usable

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "data: ~/text-fabric-data/github/Nino-cunei/uruk/sources/cdli/images" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Found 2095 ideograph linearts
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Found 2724 tablet linearts
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Found 5495 tablet photos
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A = use(\"Nino-cunei/uruk\", hoist=globals())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Starting points\n", "\n", "We need a place to begin. That could be a single tablet, or case, or a set of signs.\n", "\n", "### Single things\n", "\n", "We start with looking up a tablet by its *P-number*." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:53:50.304000Z", "start_time": "2018-05-09T16:53:50.292737Z" } }, "outputs": [ { "data": { "text/plain": [ "148166" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pNum = \"P005381\"\n", "tablet = T.nodeFromSection((pNum,))\n", "tablet" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Explanation**\n", "\n", "We have imposed a division in sections on the Uruk corpus.\n", "Three levels:\n", "* tablets;\n", "* columns;\n", "* line.\n", "\n", "With `T` we get access to section functions.\n", "\n", "If we identify a section, by specifying its tablet, column number, and line number,\n", "`T` will give us back the node (bar code) of that section.\n", "\n", "If we specify just a P-number, we get the node of the corresponding tablet.\n", "\n", "If we specify a P-number and a column number, we get the node of the corresponding column.\n", "\n", "If we, additionally, specify a line number, we get the node of the line.\n", "\n", "**Warning**\n", "\n", "The expression `(pNum, )` is the Python way of denoting a tuple with one element.\n", "Without the awkward comma the brackets are just grouping brackets, not tuple brackets.\n", "So if you say\n", "\n", "```\n", "tablet = T.nodeFromSection((pNum))\n", "```\n", "\n", "things go horribly wrong." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here is its transcription, because a node is just a number, not very informative to us humans." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:53:55.457566Z", "start_time": "2018-05-09T16:53:55.448923Z" } }, "outputs": [ { "data": { "text/plain": [ "['&P005381 = MSVO 3, 70',\n", " '#atf: lang qpc ',\n", " '@obverse ',\n", " '@column 1 ',\n", " '1.a. 2(N14) , SZE~a SAL TUR3~a NUN~a ',\n", " '1.b. 3(N19) , |GISZ.TE| ',\n", " '2. 1(N14) , NAR NUN~a SIG7 ',\n", " '3. 2(N04)# , PIRIG~b1 SIG7 URI3~a NUN~a ',\n", " '@column 2 ',\n", " '1. 3(N04) , |GISZ.TE| GAR |SZU2.((HI+1(N57))+(HI+1(N57)))| GI4~a ',\n", " '2. , GU7 AZ SI4~f ',\n", " '@reverse ',\n", " '@column 1 ',\n", " '1. 3(N14) , SZE~a ',\n", " '2. 3(N19) 5(N04) , ',\n", " '3. , GU7 ',\n", " '@column 2 ',\n", " '1. , AZ SI4~f ']" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "A.getSource(tablet)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And, to be even more hands on, we show the lineart:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:53:58.002286Z", "start_time": "2018-05-09T16:53:57.993993Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart(tablet, width=200)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now let's check out the columns and lines.\n", "(Note that you have to include the face-name into the column number)." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:00.162554Z", "start_time": "2018-05-09T16:54:00.151649Z" } }, "outputs": [ { "data": { "text/html": [ "
column 1
line 1
case 1a
2(N14)
SZE~a
SAL
TUR3~a
NUN~a
case 1b
3(N19)
quad
GISZ
.
TE
line 2
1(N14)
NAR
NUN~a
SIG7
line 3
2(N04)#
PIRIG~b1
SIG7
URI3~a
NUN~a
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "column = T.nodeFromSection((pNum, \"obverse:1\"))\n", "A.pretty(column)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:04.613900Z", "start_time": "2018-05-09T16:54:04.605733Z" } }, "outputs": [ { "data": { "text/plain": [ "['@column 1 ',\n", " '1.a. 2(N14) , SZE~a SAL TUR3~a NUN~a ',\n", " '1.b. 3(N19) , |GISZ.TE| ',\n", " '2. 1(N14) , NAR NUN~a SIG7 ',\n", " '3. 2(N04)# , PIRIG~b1 SIG7 URI3~a NUN~a ']" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "A.getSource(column)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now lines:" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:06.010464Z", "start_time": "2018-05-09T16:54:05.998870Z" } }, "outputs": [ { "data": { "text/html": [ "
lineNone 1
case@85116 1a
2(N14)
SZE~a
SAL
TUR3~a
NUN~a
case@85117 1b
3(N19)
quad
GISZ
.
TE
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "line = T.nodeFromSection((pNum, \"obverse:1\", \"1\"))\n", "A.pretty(line, lineNumbers=True)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T14:34:08.404060Z", "start_time": "2018-05-01T14:34:08.395035Z" } }, "outputs": [ { "data": { "text/plain": [ "['85116: 1.a. 2(N14) , SZE~a SAL TUR3~a NUN~a ',\n", " '85117: 1.b. 3(N19) , |GISZ.TE| ']" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "A.getSource(line, lineNumbers=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here we have requested the line numbers in the source files.\n", "These source files are also in the data repo, e.g.\n", "[uruk-iii](https://github.com/Nino-cunei/uruk/blob/master/sources/cdli/transcriptions/1.0/uruk-iii.txt).\n", "\n", "We want to go one step further. We want to get the node corresponding to\n", "individual lines in the transliterations.\n", "These correspond to cases which are themselves not divided into cases\n", "(*terminal* cases).\n", "\n", "Text-Fabric itself only knows three section levels, we cannot use `T.sectionFromNode()`\n", "for this.\n", "Text-Fabric is a generic package, which has been used for various other\n", "corpora, such as the Hebrew Bible. It does not know anything of (proto)cuneiform data,\n", "nor of the Hebrew Bible, for that matter.\n", "\n", "But on top of Text-Fabric we are using a bunch of dedicated cuneiform functions, and\n", "one of them mimics `T.nodeFromSection`:" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:08.261135Z", "start_time": "2018-05-09T16:54:08.246885Z" } }, "outputs": [ { "data": { "text/html": [ "
case 1b
3(N19)
quad
GISZ
.
TE
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "case = A.nodeFromCase((pNum, \"obverse:1\", \"1.b\"))\n", "A.pretty(case)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T14:35:17.767634Z", "start_time": "2018-05-01T14:35:17.758142Z" } }, "outputs": [ { "data": { "text/plain": [ "['85117 1.b. 3(N19) , |GISZ.TE| ']" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "A.getSource(case, lineNumbers=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Sets\n", "\n", "Many times we want to start with whole sets.\n", "For example all composite signs, also known as *quads*:" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:10.281199Z", "start_time": "2018-05-09T16:54:10.272765Z" } }, "outputs": [ { "data": { "text/plain": [ "3794" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "quads = F.otype.s(\"quad\")\n", "len(quads)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This reads as:\n", "\n", "* `F` give me the features\n", "* `otype` I want the feature that gives the type of nodes\n", "* `s('quad')` I want the nodes whose `otype` value is `'quad'`\n", " i.e. the nodes that *support* `otype`-value `'quad'`\n", "\n", "As we see, there are nearly 4000 of them.\n", "\n", "Later, we'll see where they are." ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:11.567587Z", "start_time": "2018-05-09T16:54:11.557559Z" } }, "outputs": [ { "data": { "text/plain": [ "1" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "primes = F.prime.s(2)\n", "len(primes)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the same manner, we want to see all things with a double prime.\n", "There is only one.\n", "We pick up a bit of additional information, but later we'll see where it is." ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:12.499455Z", "start_time": "2018-05-09T16:54:12.490217Z" } }, "outputs": [ { "data": { "text/html": [ "
56360 1(N24'')#
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for n in primes:\n", " A.pretty(n, withNodes=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It is the sign with node (bar code) 56360.\n", "\n", "Alas, there is no lineart for this sign.\n", "Click the link under `sign` to go to the CDLI page for the tablet on which this sign occurs." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Walk all nodes\n", "\n", "If we want to go over all nodes, in a sensible order, we do it like this:" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:14.593325Z", "start_time": "2018-05-09T16:54:14.487575Z" } }, "outputs": [ { "data": { "text/plain": [ "263067" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "count = 0\n", "\n", "for n in N.walk():\n", " count += 1\n", "\n", "count" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here we show the first 20 nodes with their type:" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:15.869313Z", "start_time": "2018-05-09T16:54:15.856425Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "143889 tablet\n", "169360 comment\n", " 1 sign\n", "150253 face\n", "180450 column\n", "227226 line\n", "194473 cluster\n", " 2 sign\n", " 3 sign\n", " 4 sign\n", "180451 column\n", "227227 line\n", " 5 sign\n", " 6 sign\n", " 7 sign\n", "194474 cluster\n", " 8 sign\n", "143890 tablet\n", "169361 comment\n", " 9 sign\n" ] } ], "source": [ "limit = 20\n", "for (i, n) in enumerate(N.walk()):\n", " if i >= limit:\n", " break\n", " print(f\"{n:>6} {F.otype.v(n)}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As you see, the order is not the sequence order of the nodes.\n", "You see first things (in the corpus) first, and if several things start at the same\n", "position, the bigger things come first." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Navigation\n", "\n", "After our starting points, we would like to visit the neighbourhood.\n", "We want to go from nodes to the ones in which they lie embedded, and back.\n", "We want to go to the next node on the same level and back.\n", "\n", "We do that with `L.` functions.\n", "\n", "* `L.d()` goes \"down\": from embedder to embeddee;\n", "* `L.u()` goes \"up\": from embeddee to embedder;\n", "* `L.p()` goes \"previous\": to the first left sibling;\n", "* `L.n()` goes \"next\": to the first right sibling.\n", "\n", "Above, we collected some \"interesting\" nodes, but we had not yet a way to find out where\n", "they were.\n", "\n", "Now we have.\n", "\n", "Remember the double prime?" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:18.884846Z", "start_time": "2018-05-09T16:54:18.874674Z" } }, "outputs": [ { "data": { "text/html": [ "
case@51246 3b
3(N41)
1(N24'')#
cluster ?
TAR~a
cluster ?
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "caseDouble = L.u(primes[0], otype=\"case\")[0]\n", "A.pretty(caseDouble, lineNumbers=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So we can go to the source, to the exact line number!\n", "\n", "We can also show the whole tablet.\n", "\n", "It is a bit of a puzzle to spot the `1(N24'')`.\n", "In the notebook on [search](search.ipynb) we'll show how you can highlight things on a tablet." ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:22.382606Z", "start_time": "2018-05-09T16:54:22.357479Z" } }, "outputs": [ { "data": { "text/html": [ "
tablet P411604
CUSAS 21, 074uruk-iii
comment
atf: lang qpc
face obverse
column 1
line 1
1(N01)
AN
NUNUZ~a1
ZATU788#
line 2
1(N01)
1(N39~a)
MUD
NA~a#
BU~a
line 3
1(N01)
1(N39~a)
U4#
KU6~a
A
line 4
1(N01)
1(N39~a)
AB~a
SZE~a
line 5
3(N01)
BAHAR2~b
line 6
2(N01)
cluster ?
...
cluster ?
line 7
2(N01)
cluster ?
...
cluster ?
MUD#
cluster ?
NA~a
cluster ?
BU~a#
column 2
line 1
case 1a
2(N01)
1(N57)
NIN
case 1b
1(N39~a)
TAR~a
line 2
case 2a
4(N01)
ZATU694
KU6~a
KISAL~b1
case 2b
2(N39~a)
TAR~a
line 3
1(N39~a)
AB~a
SZUBUR
BULUG3
SZE~a
line 4
GIBIL
GU7
line 5
2(N04)
1(N41)
U4
line 6
1(N19)
NAM~a
NA2~a
column 3
line 1
case 1a
3(N01)
3(N57)
cluster ?
...
cluster ?
case 1b
2(N39~a)
1(N24)
cluster ?
TAR~a
cluster ?
line 2
1(N19)
AB~a
line 3
case 3a
1(N19)
1(N04)
AN
NUNUZ~a1#
ZATU788
X
case 3b
3(N41)
1(N24'')#
cluster ?
TAR~a
cluster ?
line 4
GU7
face reverse
comment
blank space
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "tabletDouble = L.u(primes[0], otype=\"tablet\")[0]\n", "A.pretty(tabletDouble, standardFeatures=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `L.u()` function takes a node as starting point and looks up all nodes that embed it.\n", "You can restrict those to nodes of a certain type, as we did by `otype='case'`.\n", "It yields a tuple of nodes, so if you want a single embedder, you have to select one,\n", "as we did by `[0]`." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Earlier we collected all *quads* (composite signs).\n", "Let us look up info for them.\n", "\n", "The least technical way is ... a one-liner!" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:25.559444Z", "start_time": "2018-05-09T16:54:25.504685Z" } }, "outputs": [ { "data": { "text/html": [ "
quad
DUG~b
x
1(N57)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
quad
U4
x
1(N01)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
quad
U4
.
1(N08)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
quad
U4
.
1(N08)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
quad
U4
.
1(N08)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
quad
GI
&
GI
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
quad
U4
.
1(N08)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
quad
U4
.
1(N08)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
quad
U4
x
3(N01)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
quad
LAGAB~b
x
X
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for q in quads[0:10]:\n", " A.pretty(q)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can also assemble custom information.\n", "\n", "For each such quad we assemble the following pieces of information:\n", "\n", "* the P-number of the tablet\n", "* the transcription line number\n", "* a representation of the quad\n", "* the list of signs of which the quad is composed." ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "ExecuteTime": { "end_time": "2018-05-09T16:54:26.899929Z", "start_time": "2018-05-09T16:54:26.890322Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 27 P006428 5 |DUG~bx1(N57)| with DUG~b , 1(N57)\n", " 66 P448702 1 |U4x1(N01)| with U4 , 1(N01)\n", " 80 P448703 1 |U4.1(N08)| with U4 , 1(N08)\n", " 81 P448703 2 |U4.1(N08)| with U4 , 1(N08)\n", " 82 P448703 3 |U4.1(N08)| with U4 , 1(N08)\n", " 82 P448703 3 |GI&GI| with GI , GI\n", " 83 P448703 4 |U4.1(N08)| with U4 , 1(N08)\n", " 84 P448703 5 |U4.1(N08)| with U4 , 1(N08)\n", " 142 P482083 2a |U4x3(N01)| with U4 , 3(N01)\n", " 161 P499393 2 |LAGAB~bxX| with LAGAB~b , X\n" ] } ], "source": [ "for q in quads[0:10]:\n", " cl = A.lineFromNode(q)\n", " (pNum, colNum, caseNum) = A.caseFromNode(cl)\n", " lineNum = F.srcLnNum.v(cl)\n", "\n", " qRep = A.atfFromQuad(q)\n", " signs = L.d(q, otype=\"sign\")\n", " signReps = \" , \".join([A.atfFromSign(s) for s in signs])\n", " print(f\"{lineNum:>5} {pNum} {caseNum:<5} {qRep:<15} with {signReps}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Admittedly, this was a bit advanced. We used things we haven't explained yet.\n", "\n", "* `A.lineFromNode()`: if your node is something that fits in a single transcription line (\n", " (a sign or quad or cluster), it will give you the node that corresponds to that\n", " transcription line (a terminal case or terminal line);\n", "* `A.caseFromNode()`: gives you section headings\n", " with case numbers instead of line numbers for nodes\n", " if you give it a node. (exactly opposite to `A.nodeFromCase()`);\n", "* likewise, `T.sectionFromNode()` is opposite to `T.nodeFromSection()`.\n", "* we have functions to generate ATF transliterations for nodes, especially for\n", " quads and signs:\n", " * `A.atfFromQuad(n)` gives you the transliteration of the\n", " *quad* identified by node (bar code) `n`;\n", " * `A.atfFromSign(n)` likewise for *sign*s." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "With our mastery of starting points and navigation,\n", "we really do not have to see the actual node numbers (bar codes) anymore.\n", "\n", "We'll see less and less of them, but they are the invisible glue that\n", "holds the whole corpus together." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# See also\n", "\n", "[jumps](jumps.ipynb)\n", "\n", "Because there are more ways to travel ...\n", "\n", "# Next\n", "\n", "[search](search.ipynb)\n", "\n", "*Don't get lost ...*\n", "\n", "All chapters:\n", "[start](start.ipynb)\n", "[imagery](imagery.ipynb)\n", "**steps**\n", "[search](search.ipynb)\n", "[calc](calc.ipynb)\n", "[signs](signs.ipynb)\n", "[quads](quads.ipynb)\n", "[jumps](jumps.ipynb)\n", "[cases](cases.ipynb)\n", "\n", "---\n", "\n", "CC-BY Dirk Roorda" ] } ], "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.1" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": true, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": true, "toc_position": { "height": "607px", "left": "0px", "right": "983px", "top": "110px", "width": "297px" }, "toc_section_display": "block", "toc_window_display": false }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }