"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.table(results, condensed=True, condenseType=\"line\", end=5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"And we can show them inside the face they occur in:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"result 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P006427
Anonymous 006427uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 2"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P006428
Anonymous 006428uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results, condenseType=\"face\", end=2, skipCols=\"1\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The feature *type* is displayed because it occurs in the query.\n",
"We can make the display a bit more compact by suppressing those features:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"result 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P006427
Anonymous 006427uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 2"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P006428
Anonymous 006428uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results, condenseType=\"face\", end=2, queryFeatures=False, skipCols=\"1\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Finding a tablet\n",
"\n",
"Suppose we have the *p-number* of a tablet.\n",
"How do we find that tablet?\n",
"Remembering from the feature docs that the p-numbers are stored in the feature\n",
"`catalogId`, we can write a *search template*."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:10.302974Z",
"start_time": "2018-05-24T10:17:10.275639Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.00s 1 result\n"
]
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"tablet catalogId=P005381\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The function `A.table()` gives you a tabular overview of the results,\n",
"with a link to the tablet on CDLI.\n",
"\n",
"But we can also get more information by using `A.show()`:"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:11.778651Z",
"start_time": "2018-05-24T10:17:11.761567Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"result 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P005381
MSVO 3, 70uruk-iiicatalogId=P005381
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Several things to note here\n",
"\n",
"* if you want to see the tablet on CDLI, you can click on the tablet header;\n",
"* the display matches the layout on the tablet:\n",
" * faces and columns are delineated with red lines\n",
" * lines and cases are delineated with blue lines\n",
" * cases and subcases alternate their direction of division between horizontal and vertical:\n",
" lines are horizontally divided into cases, they are vertically divided into subcases, and they\n",
" in turn are horizontally divided in subsubcases, etc.\n",
" * quads and signs are delineated with grey lines\n",
" * clusters are delineated with brown lines (see further on)\n",
" * lineart is given for top-level signs and quads; those that are part of a bigger quad do not\n",
" get lineart;\n",
"\n",
"It is possible to switch off the lineart."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## More info in the results\n",
"You can show the line numbers that correspond to the ATF source files as well.\n",
"Let us also switch off the lineart."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:14.948197Z",
"start_time": "2018-05-24T10:17:14.911049Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.00s 1 result\n"
]
},
{
"data": {
"text/html": [
"n | p | tablet |
\n",
"1 | P005381 | @85111 P005381 |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet@85111 P005381
MSVO 3, 70uruk-iiicatalogId=P005381
comment@85112
atf: lang qpc
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"tablet catalogId=P005381\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results, lineNumbers=True)\n",
"A.show(results, lineNumbers=True, showGraphics=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There is a big quad in `obverse:2 line 1`. We want to call up the lineart for it separately.\n",
"First step: make the nodes visible."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:16.760443Z",
"start_time": "2018-05-24T10:17:16.724844Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.00s 1 result\n"
]
},
{
"data": {
"text/html": [
"n | p | tablet |
\n",
"1 | P005381 | 148166 P005381 |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet:148166 P005381
MSVO 3, 70uruk-iiicatalogId=P005381
comment:178162
atf: lang qpc
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"tablet catalogId=P005381\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results, withNodes=True)\n",
"A.show(results, withNodes=True, showGraphics=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We read off the node number of that quad and fetch the lineart."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:18.666778Z",
"start_time": "2018-05-24T10:17:18.656611Z"
}
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.lineart(143015)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Search templates\n",
"Let's highlight all numerals on the tablet.\n",
"\n",
"We prefer our results to be condensed per tablet for the next few shows.\n",
"\n",
"We make that the temporary default:"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"A.displaySetup(condensed=True)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:21.430933Z",
"start_time": "2018-05-24T10:17:21.125331Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.05s 10 results\n"
]
},
{
"data": {
"text/html": [
"tablet 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P005381
MSVO 3, 70uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"tablet catalogId=P005381\n",
" sign type=numeral\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.show(results, queryFeatures=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can do the same for multiple tablets. But now we highlight the undivided lines,\n",
"just for variation."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:25.919381Z",
"start_time": "2018-05-24T10:17:25.800395Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.01s 11 results\n"
]
}
],
"source": [
"query = \"\"\"\n",
"tablet catalogId=P003581|P000311\n",
" line terminal\n",
"\"\"\"\n",
"results = A.search(query)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:25.919381Z",
"start_time": "2018-05-24T10:17:25.800395Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"n | tablet | line | line | line | line | line | line |
\n",
"1 | P000311 | [1(N01)] [...] IR~a | [1(N01)] ERIM2 | 1(N01) NIMGIR SIG7 | 1(N01) U2~b NAGA~a MUSZEN ZATU647 BA | 1(N01) IM~a [...] | [N] [...] |
\n",
"2 | P003581 | 5(N01) U2~a [...] | 1(N01) X [...] | 1(N14) [...] SUHUR [...] | 5(N14) 1(N01) [...] U2~a | |GI&GI| GU7 |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.table(results, showGraphics=False, withPassage=False)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:25.919381Z",
"start_time": "2018-05-24T10:17:25.800395Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"tablet 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P000311
CDLI Lexical 000034, ex. 01uruk-iiiW 20266,065catalogId=P000311
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet 2"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P003581
W 20274,083uruk-iiiW 20274,083catalogId=P003581
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results, showGraphics=False, condenseType=\"tablet\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In an other chapter of this tutorial, [steps](steps.ipynb) we encounter a grapheme with a double prime.\n",
"There is only one, and we showed the tablet on which it occurs, without highlighting the grapheme in question.\n",
"Now we can do the highlight:"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:42.815595Z",
"start_time": "2018-05-24T10:17:42.580015Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.04s 1 result\n"
]
}
],
"source": [
"results = A.search(\n",
" \"\"\"\n",
"sign prime=2\n",
"\"\"\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"tablet 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P411604
CUSAS 21, 074uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Search for spatial patterns\n",
"A few words on the construction of search templates.\n",
"\n",
"The idea is that you mimic the things you are looking for\n",
"in your search template.\n",
"Embedded things are mimicked by indentation.\n",
"\n",
"Let's search for a line with a case in it that is not further divided,\n",
"in which there is a numeral and an ideograph.\n",
"\n",
"Here is our first attempt, and we show the first tablet only.\n",
"Note that you can have comments in a search template.\n",
"Lines that start with `#` are ignored."
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:46.856080Z",
"start_time": "2018-05-24T10:17:46.284836Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.14s 10673 results\n"
]
}
],
"source": [
"query = \"\"\"\n",
"line\n",
" case terminal=1\n",
"% order is not important\n",
" sign type=ideograph\n",
" sign type=numeral\n",
"\"\"\"\n",
"results = A.search(query)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First a glance at the first 3 items in tabular view."
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:49.495993Z",
"start_time": "2018-05-24T10:17:49.480690Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"n | p | tablet | sign | sign | sign | line | sign | case | sign | sign | case | sign | sign |
\n",
"1 | P448702 obverse:1:2 | P448702 | 3(N01) | KASZ~a | GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 3(N01) | 2b'3(N01) KASZ~a GI | N | 2(N14) | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | KASZ~b | NUN~a |
\n",
"2 | P471695 obverse:2:1 | P471695 | 2b1(3(N57) PAP~a)a | 1(N01) | ISZ~a | 1a1(N01) ISZ~a | 3(N01) | APIN~a | 3(N57) | UR4~a | 1a3(N01) APIN~a 3(N57) UR4~a 1b1b1(EN~a DU ZATU759)a 1b2(BAN~b KASZ~c)a 1b3(KI@n SAG)a | 2a1(N14) 2(N01) [...] 2b2b1(3(N57) PAP~a)a 2b2 (SZU KI X)a 2b3'(EN~a AN EZINU~d)a 2b4' (IDIGNA [...])a | 1a1(N01) ISZ~a 1b1b1 (PAP~a GIR3~c)a | 3(N57) | PAP~a | 1a3(N01) APIN~a 3(N57) UR4~a |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.table(results, end=2, showGraphics=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Ah, we were still in condensed mode.\n",
"\n",
"For this query the table is more perspicuous in normal mode, so we tell not to condense."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:49.495993Z",
"start_time": "2018-05-24T10:17:49.480690Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"n | p | line | case | sign | sign |
\n",
"1 | P448702 obverse:1:2 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | KASZ~b | N |
\n",
"2 | P448702 obverse:1:2 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | KASZ~b | 2(N14) |
\n",
"3 | P448702 obverse:1:2 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | KASZ~b | 3(N01) |
\n",
"4 | P448702 obverse:1:2 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | NUN~a | N |
\n",
"5 | P448702 obverse:1:2 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | NUN~a | 2(N14) |
\n",
"6 | P448702 obverse:1:2 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | NUN~a | 3(N01) |
\n",
"7 | P448702 obverse:1:2 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2b'3(N01) KASZ~a GI | KASZ~a | 3(N01) |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.table(results, condensed=False, end=7, showGraphics=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now the results on the first tablet, condensed by line."
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:52.967852Z",
"start_time": "2018-05-24T10:17:52.635909Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"line 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results, end=1, condenseType=\"line\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The order between the two signs is not defined by the template,\n",
"despite the fact that the line with the ideograph\n",
"precedes the line with the numeral.\n",
"Results may have the numeral and the ideograph in any order.\n",
"\n",
"In fact, the highlights above represent multiple results.\n",
"If a case has say 2 numerals and 3 ideographs, there are 6 possible\n",
"pairs.\n",
"\n",
"By default, results are shown in *condensed* mode.\n",
"That means that results are shown per tablet, and on the result tablets\n",
"everything that is in some result is being highlighted.\n",
"\n",
"It is also possible to see the uncondensed results.\n",
"That gives you an exact picture of each real result constellation.\n",
"\n",
"In order to illustrate the difference, we focus on one tablet and one case.\n",
"This case has 3 numerals and 2 ideographs, so we expect 6 results."
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:56.152337Z",
"start_time": "2018-05-24T10:17:55.609431Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.10s 6 results\n"
]
}
],
"source": [
"query = \"\"\"\n",
"tablet catalogId=P448702\n",
" line\n",
" case terminal=1 number=2a\n",
" sign type=ideograph\n",
" sign type=numeral\n",
"\"\"\"\n",
"results = A.search(query)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We show them condensed (by default), so we expect 1 line with all ideographs and numerals in case `2a'` highlighted."
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:17:58.399716Z",
"start_time": "2018-05-24T10:17:58.386450Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"line 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"line 2
number=2
case 2a'
number=2aterminal=1
case 2b'
number=2bterminal=1
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results, showGraphics=False, condenseType=\"line\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now the same results in uncondensed mode. Expect 6 times the same line with\n",
"different highlighted pairs of signs.\n",
"\n",
"Note that we can apply different highlight colours to different parts of the result.\n",
"The words in the pair are member 4 and 5.\n",
"\n",
"The members that we do not map, will not be highlighted.\n",
"The members that we map to the empty string will be highlighted with the default color.\n",
"\n",
"**NB:** Choose your colours from the\n",
"[CSS specification](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value)."
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [],
"source": [
"A.displaySetup(\n",
" condensed=False,\n",
" skipCols=\"1\",\n",
" colorMap={2: \"\", 3: \"cyan\", 4: \"magenta\"},\n",
" showGraphics=False,\n",
" condenseType=\"line\",\n",
" queryFeatures=False,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:01.547855Z",
"start_time": "2018-05-24T10:18:01.495155Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"result 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P448702
Anonymous 448702uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 2"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P448702
Anonymous 448702uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 3"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P448702
Anonymous 448702uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 4"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P448702
Anonymous 448702uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 5"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P448702
Anonymous 448702uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 6"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P448702
Anonymous 448702uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Color mapping works best for uncondensed results. If you condense results, some nodes may occupy\n",
"different positions in different results. It is unpredictable which color will be used\n",
"for such nodes:"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:08.424670Z",
"start_time": "2018-05-24T10:18:08.412515Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"line 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results, condensed=True)"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
"A.displayReset()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can enforce order.\n",
"We modify the template a little to state a\n",
"relational condition, namely that the ideograph follows the numeral."
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:13.882678Z",
"start_time": "2018-05-24T10:18:13.342157Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.11s 6 results\n"
]
},
{
"data": {
"text/html": [
"n | p | tablet | line | case | sign | sign |
\n",
"1 | P448702 obverse:1:2 | P448702 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | KASZ~b | N |
\n",
"2 | P448702 obverse:1:2 | P448702 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | KASZ~b | 2(N14) |
\n",
"3 | P448702 obverse:1:2 | P448702 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | KASZ~b | 3(N01) |
\n",
"4 | P448702 obverse:1:2 | P448702 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | NUN~a | N |
\n",
"5 | P448702 obverse:1:2 | P448702 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | NUN~a | 2(N14) |
\n",
"6 | P448702 obverse:1:2 | P448702 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | NUN~a | 3(N01) |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"tablet catalogId=P448702\n",
" line\n",
" case terminal=1 number=2a\n",
" sign type=ideograph\n",
" > sign type=numeral\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results, condensed=False, showGraphics=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Still six results.\n",
"No wonder, because the case has first three numerals in a row and then 2 ideographs.\n",
"\n",
"Do you want the ideograph and the numeral to be *adjacent* as well?\n",
"We only have to add 1 character to the template to make it happen."
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:18.838300Z",
"start_time": "2018-05-24T10:18:18.284271Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.12s 1 result\n"
]
}
],
"source": [
"query = \"\"\"\n",
"tablet catalogId=P448702\n",
" line\n",
" case terminal=1 number=2a\n",
" sign type=ideograph\n",
" :> sign type=numeral\n",
"\"\"\"\n",
"results = A.search(query)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:18.838300Z",
"start_time": "2018-05-24T10:18:18.284271Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"n | p | tablet | line | case | sign | sign |
\n",
"1 | P448702 obverse:1:2 | P448702 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a 2b'3(N01) KASZ~a GI | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a | KASZ~b | 3(N01) |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.table(results, condensed=False, showGraphics=False)"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [],
"source": [
"A.displaySetup(\n",
" condensed=False,\n",
" skipCols=\"1\",\n",
" colorMap={2: \"\", 3: \"cyan\", 4: \"magenta\"},\n",
" showGraphics=False,\n",
" condenseType=\"line\",\n",
" queryFeatures=False,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:18.838300Z",
"start_time": "2018-05-24T10:18:18.284271Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"result 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P448702
Anonymous 448702uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results, condensed=False)"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [],
"source": [
"A.displayReset()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"By now it pays off to study the possibilities of\n",
"[search templates](https://annotation.github.io/text-fabric/tf/about/searchusage.html).\n",
"\n",
"If you want a reminder of all possible spatial relationships between nodes, you can call it up\n",
"here in your notebook:"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:21.290354Z",
"start_time": "2018-05-24T10:18:21.285739Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" = left equal to right (as node)\n",
" # left unequal to right (as node)\n",
" < left before right (in canonical node ordering)\n",
" > left after right (in canonical node ordering)\n",
" == left occupies same slots as right\n",
" && left has overlapping slots with right\n",
" ## left and right do not have the same slot set\n",
" || left and right do not have common slots\n",
" [[ left embeds right\n",
" ]] left embedded in right\n",
" << left completely before right\n",
" >> left completely after right\n",
" =: left and right start at the same slot\n",
" := left and right end at the same slot\n",
" :: left and right start and end at the same slot\n",
" <: left immediately before right\n",
" :> left immediately after right\n",
" =k: left and right start at k-nearly the same slot\n",
" :k= left and right end at k-nearly the same slot\n",
" :k: left and right start and end at k-near slots\n",
" left k-nearly after right\n",
" .f. left.f = right.f\n",
" .f=g. left.f = right.g\n",
" .f~r~g. left.f matches right.g\n",
" .f#g. left.f # right.g\n",
" .f>g. left.f > right.g\n",
" .f edge feature \"comments\"\n",
" edge feature \"comments\" (either direction)\n",
" -op> edge feature \"op\" with value specification allowed\n",
" edge feature \"op\" with value specification allowed (either direction)\n",
" -sub> edge feature \"sub\"\n",
" edge feature \"sub\" (either direction)\n",
"The warp feature \"oslots\" cannot be used in searches.\n",
"One of the above relations on nodes and/or slots will suit you better.\n"
]
}
],
"source": [
"S.relationsLegend()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Comparisons in templates: cases\n",
"\n",
"Cases have a feature depth which indicate their nesting depth within a line.\n",
"It is not the depth *of* that case, but the depth *at* which that case occurs.\n",
"\n",
"Comparison queries are handy to select cases of a certain minimum or maximum depth."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We'll work a lot with `condensed=False`, and `lineart` likewise, so let's make that the default:"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [],
"source": [
"A.displaySetup(condensed=False, showGraphics=False)"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:24.286961Z",
"start_time": "2018-05-24T10:18:24.255031Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.00s 254 results\n"
]
},
{
"data": {
"text/html": [
"n | p | case |
\n",
"1 | P003357 obverse:1:1 | 1b1AEN~a ZATU759 DU |
\n",
"2 | P003357 obverse:1:1 | 1b1B3(N57) SU~a |
\n",
"3 | P003537 obverse:5:4 | 4b1A3(N57) X SZA U4 [...] X |
\n",
"4 | P003537 obverse:5:4 | 4b1BX X |
\n",
"5 | P003537 obverse:5:4 | 4b2A2(N57) GAN~b SZU [...] |
\n",
"6 | P003537 obverse:5:4 | 4b2BX [...] |
\n",
"7 | P003589 obverse:1:3 | 3b2A|GA~a.ZATU753| |
\n",
"8 | P003589 obverse:1:3 | 3b2BMUD [...] |
\n",
"9 | P003822 obverse:1:1 | 1a2A[...] [...] |
\n",
"10 | P003822 obverse:1:1 | 1a2B[...] PAP~a SU~a |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"case depth=3\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results, end=10)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Are there deeper cases?"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:29.110454Z",
"start_time": "2018-05-24T10:18:29.072076Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.00s 119 results\n"
]
},
{
"data": {
"text/html": [
"n | p | case |
\n",
"1 | P004735 obverse:2:1 | 1b1B1(NAB DI |BU~a+DU6~a|)a |
\n",
"2 | P004735 obverse:2:1 | 1b1B2(ZI~a#? AN)a |
\n",
"3 | P004735 obverse:2:1 | 1b1B3(ANSZE~e 7(N57) DUR2 DU)a |
\n",
"4 | P004735 obverse:2:1 | 1b1B4(LAL3~a#? GAR IG~b)a |
\n",
"5 | P004735 obverse:2:2 | 2b2B1(GI6 KISZIK~a# URI3~a)a |
\n",
"6 | P004735 obverse:2:2 | 2b2B2([...])a |
\n",
"7 | P218054 reverse:1:1 | 1a1A1[...] 5(N01) [...] UDU~a |
\n",
"8 | P218054 reverse:1:1 | 1a1A2[...] 7(N01) MASZ2 |
\n",
"9 | P325754 reverse:1:1 | 1c2b11(N01) [...] |
\n",
"10 | P325754 reverse:1:1 | 1c2b21(N14) 7(N01) TUR |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"case depth>3\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results, end=10)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Still deeper?"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:33.726027Z",
"start_time": "2018-05-24T10:18:33.700012Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.00s 0 results\n"
]
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"case depth>4\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results, end=10)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As a check: the cases with depth 4 should be exactly the cases with depth > 3:"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:38.070599Z",
"start_time": "2018-05-24T10:18:38.038606Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.01s 119 results\n"
]
},
{
"data": {
"text/html": [
"n | p | case |
\n",
"1 | P004735 obverse:2:1 | 1b1B1(NAB DI |BU~a+DU6~a|)a |
\n",
"2 | P004735 obverse:2:1 | 1b1B2(ZI~a#? AN)a |
\n",
"3 | P004735 obverse:2:1 | 1b1B3(ANSZE~e 7(N57) DUR2 DU)a |
\n",
"4 | P004735 obverse:2:1 | 1b1B4(LAL3~a#? GAR IG~b)a |
\n",
"5 | P004735 obverse:2:2 | 2b2B1(GI6 KISZIK~a# URI3~a)a |
\n",
"6 | P004735 obverse:2:2 | 2b2B2([...])a |
\n",
"7 | P218054 reverse:1:1 | 1a1A1[...] 5(N01) [...] UDU~a |
\n",
"8 | P218054 reverse:1:1 | 1a1A2[...] 7(N01) MASZ2 |
\n",
"9 | P325754 reverse:1:1 | 1c2b11(N01) [...] |
\n",
"10 | P325754 reverse:1:1 | 1c2b21(N14) 7(N01) TUR |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"case depth=4\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results, end=10)\n",
"tc4 = len(results)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Terminal cases at depth 1 are top-level divisions of lines that are not themselves divided further."
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:41.114124Z",
"start_time": "2018-05-24T10:18:41.064714Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.01s 5468 results\n"
]
},
{
"data": {
"text/html": [
"n | p | case |
\n",
"1 | P448702 obverse:1:2 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a |
\n",
"2 | P448702 obverse:1:2 | 2b'3(N01) KASZ~a GI |
\n",
"3 | P471695 obverse:1:1 | 1a3(N01) APIN~a 3(N57) UR4~a |
\n",
"4 | P471695 obverse:1:2 | 2a1(N14) 2(N01) [...] |
\n",
"5 | P471695 obverse:2:1 | 1a1(N01) ISZ~a |
\n",
"6 | P482083 obverse:1:1 | 1a'[...] 1(N14) [...] SZE~a |
\n",
"7 | P482083 obverse:1:1 | 1b'[N] TAR~a |
\n",
"8 | P482083 obverse:1:2 | 2a'3(N01) SZE~a KASZ~b |U4x3(N01)| |
\n",
"9 | P482083 obverse:1:2 | 2b' 1(N42~a) 1(N25) TAR~a |
\n",
"10 | P006438 obverse:1:2 | 2aKU6~a BU~a |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"case depth=1 terminal\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results, end=10)\n",
"tc1 = len(results)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now let us select both the terminal cases of level 1 and 4.\n",
"They are disjunct, so the amounts should add up."
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:43.551533Z",
"start_time": "2018-05-24T10:18:43.505697Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.01s 5587 results\n"
]
},
{
"data": {
"text/html": [
"n | p | case |
\n",
"1 | P448702 obverse:1:2 | 2a'[N] 2(N14) 3(N01) KASZ~b NUN~a |
\n",
"2 | P448702 obverse:1:2 | 2b'3(N01) KASZ~a GI |
\n",
"3 | P471695 obverse:1:1 | 1a3(N01) APIN~a 3(N57) UR4~a |
\n",
"4 | P471695 obverse:1:2 | 2a1(N14) 2(N01) [...] |
\n",
"5 | P471695 obverse:2:1 | 1a1(N01) ISZ~a |
\n",
"6 | P482083 obverse:1:1 | 1a'[...] 1(N14) [...] SZE~a |
\n",
"7 | P482083 obverse:1:1 | 1b'[N] TAR~a |
\n",
"8 | P482083 obverse:1:2 | 2a'3(N01) SZE~a KASZ~b |U4x3(N01)| |
\n",
"9 | P482083 obverse:1:2 | 2b' 1(N42~a) 1(N25) TAR~a |
\n",
"10 | P006438 obverse:1:2 | 2aKU6~a BU~a |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"5468 + 119 = 5587 = 5587\n"
]
}
],
"source": [
"query = \"\"\"\n",
"case depth=1|4 terminal\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results, end=10)\n",
"tc14 = len(results)\n",
"print(f\"{tc1} + {tc4} = {tc1 + tc4} = {tc14}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Relational patterns: quads\n",
"\n",
"Quads are compositions of signs by means of *operators*, such as `.` and `x`.\n",
"The operators are coded as an *edge* feature with values. The `op`-edges are between the signs/quads that are combined,\n",
"and the values of the `op` edges are the names of the operators in question.\n",
"\n",
"Which operators do we have?"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:45.976887Z",
"start_time": "2018-05-24T10:18:45.964422Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"x : 2346x\n",
". : 1042x\n",
"& : 222x\n",
"+ : 200x\n"
]
}
],
"source": [
"for (op, freq) in E.op.freqList():\n",
" print(f\"{op} : {freq:>5}x\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Between how many sign pairs do we have an operator?"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:47.834105Z",
"start_time": "2018-05-24T10:18:47.352938Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.06s 3642 results\n"
]
}
],
"source": [
"query = \"\"\"\n",
"sign\n",
"-op> sign\n",
"\"\"\"\n",
"results = A.search(query)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Lets specifically ask for the `x` operator:"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:50.032239Z",
"start_time": "2018-05-24T10:18:49.683663Z"
},
"lines_to_next_cell": 2
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.06s 2238 results\n"
]
}
],
"source": [
"query = \"\"\"\n",
"sign\n",
"-op=x> sign\n",
"\"\"\"\n",
"results = A.search(query)"
]
},
{
"cell_type": "markdown",
"metadata": {
"lines_to_next_cell": 2
},
"source": [
"Less than expected?\n",
"\n",
"We must not forget the combinations between quads and between quads and signs.\n",
"\n",
"We write a function that gives all pairs of sign/quads connected by a specific operator.\n",
"\n",
"This is a fine illustration of how you can use programming to compose search templates,\n",
"instead of writing them out yourself."
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:52.433677Z",
"start_time": "2018-05-24T10:18:52.427761Z"
}
},
"outputs": [],
"source": [
"def getCombi(op):\n",
" types = (\"sign\", \"quad\")\n",
" allResults = []\n",
" for type1 in types:\n",
" for type2 in types:\n",
" query = f\"\"\"\n",
"{type1}\n",
"-op{op}> {type2}\n",
"\"\"\"\n",
" results = A.search(query, silent=True)\n",
" print(f\"{len(results):>5} {type1} {op} {type2}\")\n",
" allResults += results\n",
" print(f\"{len(allResults):>5} {op}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we can count all combinations with `x`:"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:54.827984Z",
"start_time": "2018-05-24T10:18:54.177596Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 2238 sign =x sign\n",
" 105 sign =x quad\n",
" 3 quad =x sign\n",
" 0 quad =x quad\n",
" 2346 =x\n"
]
}
],
"source": [
"getCombi(\"=x\")"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:56.734739Z",
"start_time": "2018-05-24T10:18:56.098035Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 985 sign =. sign\n",
" 43 sign =. quad\n",
" 14 quad =. sign\n",
" 0 quad =. quad\n",
" 1042 =.\n"
]
}
],
"source": [
"getCombi(\"=.\")"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:18:59.101012Z",
"start_time": "2018-05-24T10:18:58.459589Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 220 sign =& sign\n",
" 1 sign =& quad\n",
" 0 quad =& sign\n",
" 1 quad =& quad\n",
" 222 =&\n"
]
}
],
"source": [
"getCombi(\"=&\")"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:19:00.555930Z",
"start_time": "2018-05-24T10:18:59.932307Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 199 sign =+ sign\n",
" 0 sign =+ quad\n",
" 0 quad =+ sign\n",
" 1 quad =+ quad\n",
" 200 =+\n"
]
}
],
"source": [
"getCombi(\"=+\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In exact agreement with the results of `E.op.freqList()` above.\n",
"But we are more flexible!\n",
"\n",
"We can ask for more operators at the same time."
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:19:02.823778Z",
"start_time": "2018-05-24T10:19:02.169533Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 2437 sign =x|+ sign\n",
" 105 sign =x|+ quad\n",
" 3 quad =x|+ sign\n",
" 1 quad =x|+ quad\n",
" 2546 =x|+\n"
]
}
],
"source": [
"getCombi(\"=x|+\")"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:19:05.873634Z",
"start_time": "2018-05-24T10:19:05.095921Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 1404 sign ~[^a-z] sign\n",
" 44 sign ~[^a-z] quad\n",
" 14 quad ~[^a-z] sign\n",
" 2 quad ~[^a-z] quad\n",
" 1464 ~[^a-z]\n"
]
}
],
"source": [
"getCombi(\"~[^a-z]\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Finally, we zoom in on the rare cases where the operator is `x` used between a quad and a sign.\n",
"We want to see the show the lines where they occur."
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:19:09.476226Z",
"start_time": "2018-05-24T10:19:09.362590Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.04s 3 results\n"
]
},
{
"data": {
"text/html": [
"result 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 2"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 3"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"line\n",
" quad\n",
" -op=x> sign\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.show(results, withNodes=True, showGraphics=True, condenseType=\"line\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Hint: if you want to see where these lines come from, hover over the line indicator, or click on it.\n",
"\n",
"Alternatively, you can set the condense type to tablet.\n",
"And note that we have set the base type to `quad`, so that the pretty display does not unravel the quads."
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"result 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet:146811 P002264
IM 023435,19uruk-iiiW 15771,h
comment:176501 meta
atf: lang qpc
face:154869 obverse
column:186837 1
line:244724 1
quad:141950 |(GI&GI)xSZE3|
line:244725 2
quad:141952 |SILA3~axDUG~a| "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 2"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet:148296 P002624
W 17480,buruk-iiiW 17480,b
comment:178317 meta
atf: lang qpc
face:157130 obverse
column:190708 2
line:255151 2
quad:143119 |BU~b.NA2~a| line:255152 3
quad:143120 |(GI&GI)xSZE3|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"result 3"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet:149624 P004659
ATU 7, pl. 091, W 22133uruk-ivW 22133
comment:179698 meta
atf: lang qpc
face:158867 obverse
column:193298 1
line:260576 2
quad:143672 |(GI&GI)xGISZ@t| "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(\n",
" results, withNodes=True, showGraphics=True, condenseType=\"tablet\", baseTypes=\"quad\"\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Regular expressions in templates\n",
"We can use regular expressions in our search templates.\n",
"\n",
"### Digits in graphemes\n",
"We search for non-numeral signs whose graphemes contains digits."
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {},
"outputs": [],
"source": [
"A.displaySetup(condensed=True)"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:19:15.284182Z",
"start_time": "2018-05-24T10:19:14.908350Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.09s 14558 results\n"
]
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"sign type=ideograph grapheme~[0-9]\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results, withNodes=True, end=5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can add a bit more context easily:"
]
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:19:18.466899Z",
"start_time": "2018-05-24T10:19:17.901962Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.14s 14558 results\n"
]
},
{
"data": {
"text/html": [
"n | p | tablet | face | column | line | sign |
\n",
"1 | P448702 obverse:2:1 | P448702 | obverse | P448702 obverse:2 | U4 |U4x1(N01)| SAG SUKUD@h NA | U4 |
\n",
"2 | P448702 obverse:2:1 | P448702 | obverse | P448702 obverse:2 | U4 |U4x1(N01)| SAG SUKUD@h NA | U4 |
\n",
"3 | P448703 obverse:1:1 | P448703 | obverse | P448703 obverse:1 | |U4.1(N08)| X | U4 |
\n",
"4 | P448703 obverse:1:2 | P448703 | obverse | P448703 obverse:1 | |U4.1(N08)| GI | U4 |
\n",
"5 | P448703 obverse:1:3 | P448703 | obverse | P448703 obverse:1 | |U4.1(N08)| |GI&GI| | U4 |
\n",
"6 | P448703 obverse:1:4 | P448703 | obverse | P448703 obverse:1 | |U4.1(N08)| X | U4 |
\n",
"7 | P448703 obverse:1:5 | P448703 | obverse | P448703 obverse:1 | |U4.1(N08)| X | U4 |
\n",
"8 | P471695 obverse:1:1 | P471695 | obverse | P471695 obverse:1 | 1a3(N01) APIN~a 3(N57) UR4~a 1b1b1(EN~a DU ZATU759)a 1b2(BAN~b KASZ~c)a 1b3(KI@n SAG)a | UR4~a |
\n",
"9 | P471695 obverse:1:1 | P471695 | obverse | P471695 obverse:1 | 1a3(N01) APIN~a 3(N57) UR4~a 1b1b1(EN~a DU ZATU759)a 1b2(BAN~b KASZ~c)a 1b3(KI@n SAG)a | ZATU759 |
\n",
"10 | P471695 obverse:2:1 | P471695 | obverse | P471695 obverse:2 | 1a1(N01) ISZ~a 1b1b1 (PAP~a GIR3~c)a | GIR3~c |
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"tablet\n",
" face\n",
" column\n",
" line\n",
" sign type=ideograph grapheme~[0-9]\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results, condensed=False, end=10)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Pit numbers\n",
"\n",
"The feature `excavation` gives you the number of the pit where a tablet is found.\n",
"The syntax of pit numbers is a bit involved, here are a few possible values:\n",
"\n",
"```\n",
"W 20497\n",
"W 20335,3\n",
"W 19948,10\n",
"W 20493,26\n",
"W 17890,b\n",
"W 17729,o\n",
"W 15920,b5\n",
"W 17729,aq\n",
"W 19548,a + W 19548,b\n",
"W 17729,cn + W 17729,eq\n",
"W 14337,a + W 14337,b + W 14337,c + W 14337,d + W 14337,e\n",
"Ashm 1928-445b\n",
"```\n",
"\n",
"Let's assume we are interested in `SZITA~a1` signs occurring in cases of depth 1.\n",
"The following query finds them all:"
]
},
{
"cell_type": "code",
"execution_count": 60,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:19:21.588480Z",
"start_time": "2018-05-24T10:19:21.329207Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.05s 78 results\n"
]
}
],
"source": [
"query = \"\"\"\n",
"tablet\n",
" case depth=1\n",
" sign grapheme=SZITA variant=a1\n",
"\"\"\"\n",
"results = A.search(query)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we want to organize them by excavation number:"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:19:23.513103Z",
"start_time": "2018-05-24T10:19:23.500285Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ashm 1926,562 1\n",
"Ashm 1926,567 1\n",
"Ashm 1926,569 13\n",
"Ashm 1926,695+737+741 6\n",
"Ashm 1926,716+732 1\n",
"Ashm 1926,739 1\n",
"W 14731,z 1\n",
"W 14777,c 4\n",
"W 15776,i 1\n",
"W 15785,a2 1\n",
"W 15833,a01 + W 15833,aa04 1\n",
"W 15897,b5 1\n",
"W 15897,c26 1\n",
"W 20274,001 1\n",
"W 20274,043 1\n",
"W 20274,095 2\n",
"W 20274,119 1\n",
"W 20327,01 1\n",
"W 20327,03 1\n",
"W 20511,01 1\n",
"W 20511,02 6\n",
"W 21157 1\n",
"W 21194 1\n",
"W 21733,1 3\n",
"W 22100,01 4\n",
"W 22100,03 5\n",
"W 22101,1 1\n",
"W 23950 1\n",
"W 23973,01 1\n",
"W 24033,05 1\n",
"no pit information 13\n"
]
}
],
"source": [
"signPerPit = {}\n",
"\n",
"for (tablet, case, sign) in sorted(results):\n",
" pit = F.excavation.v(tablet) or \"no pit information\"\n",
" signPerPit.setdefault(pit, []).append(sign)\n",
"\n",
"for pit in sorted(signPerPit):\n",
" print(f\"{pit:<30} {len(signPerPit[pit]):>2}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can restrict results to those on tablets found in certain pits by constraining the search template.\n",
"If we are interested in pit `20274` we can use a regular expression that matches all 4 detailed pit numbers\n",
"based on `20274`.\n",
"So, we do not say\n",
"\n",
"```\n",
"excavation=20274\n",
"```\n",
"but\n",
"\n",
"```\n",
"excavation~20274\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:19:26.308874Z",
"start_time": "2018-05-24T10:19:26.037774Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.05s 5 results\n"
]
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"tablet excavation~20274\n",
" case depth=1\n",
" sign grapheme=SZITA variant=a1\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.table(results, condensed=False, showGraphics=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Or if we want to restrict ourselves to pit numbers with a `W`, we can say:"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {
"ExecuteTime": {
"end_time": "2018-05-24T10:19:28.493360Z",
"start_time": "2018-05-24T10:19:28.229437Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.06s 42 results\n"
]
}
],
"source": [
"query = \"\"\"\n",
"tablet excavation~W\n",
" case depth=1\n",
" sign grapheme=SZITA variant=a1\n",
"\"\"\"\n",
"results = A.search(query)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Quantifiers in templates\n",
"\n",
"So far we have seen only very positive templates.\n",
"They express what you want to see in the result.\n",
"\n",
"It is also possible to state conditions about what you do not want to see in the results."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Tablets without case divisions\n",
"\n",
"Let's find all tablets in which all lines are undivided, i.e. lines without cases."
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {},
"outputs": [],
"source": [
"query = \"\"\"\n",
"tablet\n",
"/without/\n",
" case\n",
"/-/\n",
"\"\"\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The expression\n",
"\n",
"```\n",
"/without/\n",
"template\n",
"/-/\n",
"```\n",
"\n",
"is a [quantifier](https://annotation.github.io/text-fabric/tf/about/searchusage.html#quantifiers).\n",
"\n",
"It poses a condition on the preceding line in the template, in this case the `tablet`.\n",
"And the condition is that the template\n",
"\n",
"```\n",
"tablet\n",
" case\n",
"```\n",
"\n",
"does not have results."
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.01s 5384 results\n"
]
}
],
"source": [
"results = A.search(query)"
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"tablet 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P006427
Anonymous 006427uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet 2"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P006428
Anonymous 006428uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results, end=2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now let's find cases without numerals."
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.06s 2833 results\n"
]
}
],
"source": [
"query = \"\"\"\n",
"case\n",
"/without/\n",
" sign type=numeral\n",
"/-/\n",
"\"\"\"\n",
"results = A.search(query)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We show a few."
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"tablet 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P471695
Anonymous 471695uruk-iii
face obverse
column 1
line 2
case 2b
case 2b4'
comment
(for a total of 12 sub-cases with PNN)
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet 2"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P006438
AOST 109uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results, end=2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we can use this to get something more sophisticated: the tablets that do not have numerals in their cases. So only undivided lines may contain numerals.\n",
"\n",
"Let's find tablets that do have cases, but just no cases with numerals."
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {},
"outputs": [],
"source": [
"query = \"\"\"\n",
"tablet\n",
"/where/\n",
" case\n",
"/have/\n",
" /without/\n",
" sign type=numeral\n",
" /-/\n",
"/-/\n",
"/with/\n",
" case\n",
"/-/\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 70,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.01s 53 results\n"
]
}
],
"source": [
"results = A.search(query)"
]
},
{
"cell_type": "code",
"execution_count": 71,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"tablet 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P006438
AOST 109uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet 2"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P002044
ATU 6, pl. 043, W 14335,xuruk-iiiW 14335,x
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results, end=2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Can we find such tablet which do have numerals on their undivided lines.\n",
"\n",
"We show here a way to use the results of one query in another one:\n",
"*custom sets*.\n",
"\n",
"We put the set of tablets with cases but without numerals in cases in a set called `cntablet`.\n",
"\n",
"We run the query again, but now in shallow mode, so that the result is a set.\n",
"\n",
"By the way: read more about custom sets and shallow mode in the description of\n",
"[`A.search()`](https://annotation.github.io/text-fabric/tf/search/search.html#tf.search.search.Search.search)."
]
},
{
"cell_type": "code",
"execution_count": 72,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.01s 53 results\n"
]
}
],
"source": [
"results = A.search(query, shallow=True)\n",
"customSets = dict(cntablet=results)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we can perform a very simple query for numerals on this set: we want tablets with numerals.\n",
"By restricting ourselves to this set, we now that these numerals must occur on undivided lines."
]
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.06s 160 results\n"
]
}
],
"source": [
"query = \"\"\"\n",
"cntablet\n",
" sign type=numeral\n",
"\"\"\"\n",
"results = A.search(query, sets=customSets)"
]
},
{
"cell_type": "code",
"execution_count": 74,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"tablet 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P006438
AOST 109uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet 2"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P002082
ATU 6, pl. 047, W 14637uruk-iiiW 14637
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A.show(results, end=2, queryFeatures=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We could have found these results by one query as well.\n",
"Judge for yourself which method causes the least friction."
]
},
{
"cell_type": "code",
"execution_count": 75,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.06s 160 results\n"
]
},
{
"data": {
"text/html": [
"tablet 1"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P006438
AOST 109uruk-iii
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet 2"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"tablet P002082
ATU 6, pl. 047, W 14637uruk-iiiW 14637
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"query = \"\"\"\n",
"tablet\n",
"/without/\n",
" case\n",
" sign type=numeral\n",
"/-/\n",
"/with/\n",
" case\n",
"/-/\n",
" sign type=numeral\n",
"\"\"\"\n",
"results = A.search(query)\n",
"A.show(results, end=2, queryFeatures=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## More ...\n",
"\n",
"The capabilities of search are endless.\n",
"Often it is the quickest way to focus on a phenomenon, quicker than hand coding all the logic\n",
"to retrieve your patterns.\n",
"\n",
"That said, it is not a matter of either-or. You can use coding to craft your templates,\n",
"and you can use coding to process your results.\n",
"\n",
"It's an explosive mix. A later chapter in this tutorial shows\n",
"even more [cases](cases.ipynb).\n",
"\n",
"Have another look at\n",
"[the manual](https://annotation.github.io/text-fabric/tf/about/searchusage.html)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Next\n",
"\n",
"[calc](calc.ipynb)\n",
"\n",
"*A tablet calculator ...*\n",
"\n",
"All chapters:\n",
"[start](start.ipynb)\n",
"[imagery](imagery.ipynb)\n",
"[steps](steps.ipynb)\n",
"**search**\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
}