\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",
"
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"pNum = \"P005381\"\n",
"query = \"\"\"\n",
"tablet catalogId=P005381\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.lineart(results[0][0], width=200)\n",
"A.show(results, withNodes=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The components of quads are either sub-quads or signs.\n",
"Sub-quads are also quads in TF, and they are always a composition.\n",
"Whenever a member of a sub-quad is no longer a composition, it is a *sign*.\n",
"\n",
"Let's try to unravel the structure of the biggest quad in this tablet."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Find the quad\n",
"\n",
"First we need to get the node of this quad. Above we have seen the source code of the tablet in which\n",
"it occurs, from that we can pick the node of the case it is in:"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-09T17:08:35.891516Z",
"start_time": "2018-05-09T17:08:35.876347Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['1. 3(N04) , |GISZ.TE| GAR |SZU2.((HI+1(N57))+(HI+1(N57)))| GI4~a ']\n"
]
},
{
"data": {
"text/html": [
"
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"case = A.nodeFromCase((\"P005381\", \"obverse:2\", \"1\"))\n",
"print(A.getSource(case))\n",
"A.pretty(case, withNodes=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can easily read off the node number of this big quad.\n",
"\n",
"But we can also do it programmatically.\n",
"\n",
"In order to identify our super-quad, we list all quad nodes that are part of this case.\n",
"For every quad we list the node numbers of the signs contained in it.\n",
"\n",
"In order to know what signs are contained in any given node, we use the feature `oslots`.\n",
"Like the feature `otype`, this is a standard feature that is always available in a TF dataset.\n",
"\n",
"Unlike `otype`, `oslots` is an *edge* feature: there is an edge between every node and every slot contained in it.\n",
"\n",
"Whereas you use `F` to do stuff with node features, you use `E` to do business with edge features.\n",
"\n",
"And whereas you use `F.feature.v(node)` to get the feature value of a node, you use\n",
"`E.oslots.s(node)` to get the nodes for which there is an `oslots` edge from `node` to it."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-09T17:08:48.149978Z",
"start_time": "2018-05-09T17:08:48.138955Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"143014 array('I', [106603, 106604])\n",
"143015 array('I', [106606, 106607, 106608, 106609, 106610])\n",
"143016 array('I', [106607, 106608, 106609, 106610])\n",
"143017 array('I', [106607, 106608])\n",
"143018 array('I', [106609, 106610])\n"
]
}
],
"source": [
"for node in L.d(case, otype=\"quad\"):\n",
" print(f\"{node:>6} {E.oslots.s(node)}\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"We see what the biggest quad is.\n",
"We could have been a bit more friendly to our selves by showing the actual graphemes in the quads."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-09T17:08:51.321478Z",
"start_time": "2018-05-09T17:08:51.312988Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"143014 GISZ TE\n",
"143015 SZU2 HI N57 HI N57\n",
"143016 HI N57 HI N57\n",
"143017 HI N57\n",
"143018 HI N57\n"
]
}
],
"source": [
"for node in L.d(case, otype=\"quad\"):\n",
" print(f'{node:>6} {\" \".join(F.grapheme.v(s) for s in E.oslots.s(node))}')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"So let us get the node of the biggest quad."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-09T17:08:54.151816Z",
"start_time": "2018-05-09T17:08:54.137401Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"143015"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bigQuad = sorted(\n",
" (quad for quad in L.d(case, otype=\"quad\")), key=lambda q: -len(E.oslots.s(q))\n",
")[0]\n",
"bigQuad"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Lo and behold, it is precisely the big quad.\n",
"\n",
"This is what we are talking about:"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-09T17:08:57.374493Z",
"start_time": "2018-05-09T17:08:57.365895Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"