{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "\n", "# Search\n", "\n", "Search is essential to get around in the corpus, and it is convenient as well.\n", "Whereas the whole point of Text-Fabric is to move around in the corpus programmatically,\n", "we show that\n", "[template based search](https://annotation.github.io/text-fabric/tf/about/searchusage.html)\n", "makes everything a lot more convenient ...\n", "\n", "Along with showing how search works, we also point to pretty ways to display your search results.\n", "The good news is that `search` and `pretty` work well together." ] }, { "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-24T10:17:06.453483Z", "start_time": "2018-05-24T10:17:06.432200Z" } }, "outputs": [], "source": [ "from IPython.display import display, Markdown\n", "from tf.app import use" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2018-05-24T10:17:08.349408Z", "start_time": "2018-05-24T10:17:07.481634Z" } }, "outputs": [ { "data": { "text/markdown": [ "**Locating corpus resources ...**" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "app: ~/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:clone\", hoist=globals())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# The basics\n", "\n", "Here is a very simple query: we look for tablets containing a numeral sign." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.10s 38122 results\n" ] } ], "source": [ "query = \"\"\"\n", "tablet\n", " sign type=numeral\n", "\"\"\"\n", "\n", "results = A.search(query)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can display the results in a table (here are the first 5):" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "
nptabletsign
1P006427 obverse:2:1P0064273(N14)
2P006428 obverse:3:2P0064283(N14)
3P006428 obverse:3:3P0064281(N14)
4P006428 obverse:3:5P0064281(N01)
5P006428 obverse:3:5P0064281(N57)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.table(results, end=5, condenseType=\"line\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can combine all results that are on the same tablet:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "
nplinesign
1P006427 obverse:2:13(N14) X SANGA~a [...] 3(N14)
2P006428 obverse:3:23(N14) X 3(N14)
3P006428 obverse:3:31(N14) SUHUR 1(N14)
4P006428 obverse:3:51(N01) |DUG~bx1(N57)| 1(N01) 1(N57)
5P448701 obverse:1:11(N46) 2(N19) 4(N41) 2(N19) 4(N41) 1(N46)
" ], "text/plain": [ "" ] }, "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": [ "
face obverse
type=obverse
column 1
line 1
cluster ?
type=uncertain
...
type=ellipsis
cluster ?
type=uncertain
X
type=unknown
X
type=unknown
column 2
line 1
3(N14)
type=numeral
X
type=unknown
SANGA~a?
type=ideograph
cluster ?
type=uncertain
...
type=ellipsis
cluster ?
type=uncertain
" ], "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": [ "
face obverse
type=obverse
column 1
line 1
X
type=unknown
X
type=unknown
line 2
X
type=unknown
X
type=unknown
column 2
line 1
X
type=unknown
X
type=unknown
line 2
X
type=unknown
X
type=unknown
column 3
line 1
X
type=unknown
X
type=unknown
line 2
3(N14)
type=numeral
X
type=unknown
line 3
1(N14)
type=numeral
SUHUR
type=ideograph
line 4
X
type=unknown
X
type=unknown
line 5
1(N01)
type=numeral
quad
DUG~b
type=ideograph
x
1(N57)
type=numeral
line 6
X
type=unknown
X
type=unknown
line 7
X
type=unknown
X
type=unknown
column 4
line 1
X
type=unknown
X
type=unknown
line 2
X
type=unknown
X
type=unknown
column 5
line 1
cluster ?
type=uncertain
...
type=ellipsis
cluster ?
type=uncertain
" ], "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": [ "
face obverse
column 1
line 1
cluster ?
...
cluster ?
X
X
column 2
line 1
3(N14)
X
SANGA~a?
cluster ?
...
cluster ?
" ], "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": [ "
face obverse
column 1
line 1
X
X
line 2
X
X
column 2
line 1
X
X
line 2
X
X
column 3
line 1
X
X
line 2
3(N14)
X
line 3
1(N14)
SUHUR
line 4
X
X
line 5
1(N01)
quad
DUG~b
x
1(N57)
line 6
X
X
line 7
X
X
column 4
line 1
X
X
line 2
X
X
column 5
line 1
cluster ?
...
cluster ?
" ], "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": [ "\n", "
nptablet
1P005381P005381
" ], "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
comment
atf: lang qpc
face obverse
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
column 2
line 1
3(N04)
quad
GISZ
.
TE
GAR
quad
SZU2
.
quad
quad
HI
+
1(N57)
+
quad
HI
+
1(N57)
GI4~a
line 2
GU7
AZ
SI4~f
face reverse
column 1
line 1
3(N14)
SZE~a
line 2
3(N19)
5(N04)
line 3
GU7
column 2
line 1
AZ
SI4~f
" ], "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", "
nptablet
1P005381@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
face@85114 obverse
column@85115 1
lineNone 1
case@85116 1a
2(N14)
SZE~a
SAL
TUR3~a
NUN~a
case@85117 1b
3(N19)
quad
GISZ
.
TE
line@85118 2
1(N14)
NAR
NUN~a
SIG7
line@85119 3
2(N04)#
PIRIG~b1
SIG7
URI3~a
NUN~a
column@85120 2
line@85121 1
3(N04)
quad
GISZ
.
TE
GAR
quad
SZU2
.
quad
quad
HI
+
1(N57)
+
quad
HI
+
1(N57)
GI4~a
line@85122 2
GU7
AZ
SI4~f
face@85123 reverse
column@85124 1
line@85125 1
3(N14)
SZE~a
line@85126 2
3(N19)
5(N04)
line@85127 3
GU7
column@85128 2
line@85129 1
AZ
SI4~f
" ], "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", "
nptablet
1P005381148166 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
face:156932 obverse
column:190362 1
line:254173 1
case:167736 1a
106585 2(N14)
106586 SZE~a
106587 SAL
106588 TUR3~a
106589 NUN~a
case:167737 1b
106590 3(N19)
quad:143013
106591 GISZ
.
106592 TE
line:254174 2
106593 1(N14)
106594 NAR
106595 NUN~a
106596 SIG7
line:254175 3
106597 2(N04)#
106598 PIRIG~b1
106599 SIG7
106600 URI3~a
106601 NUN~a
column:190363 2
line:254176 1
106602 3(N04)
quad:143014
106603 GISZ
.
106604 TE
106605 GAR
quad:143015
106606 SZU2
.
quad:143016
quad:143017
106607 HI
+
106608 1(N57)
+
quad:143018
106609 HI
+
106610 1(N57)
106611 GI4~a
line:254177 2
106612 GU7
106613 AZ
106614 SI4~f
face:156933 reverse
column:190364 1
line:254178 1
106615 3(N14)
106616 SZE~a
line:254179 2
106617 3(N19)
106618 5(N04)
line:254180 3
106619 GU7
column:190365 2
line:254181 1
106620 AZ
106621 SI4~f
" ], "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
comment
atf: lang qpc
face obverse
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
column 2
line 1
3(N04)
quad
GISZ
.
TE
GAR
quad
SZU2
.
quad
quad
HI
+
1(N57)
+
quad
HI
+
1(N57)
GI4~a
line 2
GU7
AZ
SI4~f
face reverse
column 1
line 1
3(N14)
SZE~a
line 2
3(N19)
5(N04)
line 3
GU7
column 2
line 1
AZ
SI4~f
" ], "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", "\n", "
ntabletlinelinelinelinelineline
1P000311[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] [...]
2P0035815(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
comment
atf: lang qpc
face obverse
comment
beginning broken
column 1'
comment
beginning broken
line 1
terminal=1
cluster ?
1(N01)
cluster ?
cluster ?
...
cluster ?
IR~a#
line 2
terminal=1
cluster ?
1(N01)
cluster ?
ERIM2#
column 2'
comment
beginning broken
line 1
terminal=1
1(N01)
NIMGIR
SIG7#
line 2
terminal=1
1(N01)
U2~b
NAGA~a
MUSZEN
ZATU647
BA
line 3
terminal=1
comment
rest broken
1(N01)#
IM~a
cluster ?
...
cluster ?
face reverse
column 0
line 1
terminal=1
cluster ?
N
cluster ?
cluster ?
...
cluster ?
" ], "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
comment
atf: lang qpc
face obverse
column 1
line 1
terminal=1
5(N01)
U2~a#
cluster ?
...
cluster ?
column 2
line 1
case 1a
terminal=1
1(N14)
X
X
case 1b
case 1b1
terminal=1
cluster ?
...
cluster ?
X
cluster ?
...
cluster ?
case 1b2
terminal=1
I
BU3
line 2
terminal=1
1(N01)
X
cluster ?
...
cluster ?
column 3
line 1
case 1a
terminal=1
3(N01)
GA~a#
AB2
case 1b
terminal=1
cluster ?
...
cluster ?
GI
3(N57)
line 2
terminal=1
1(N14)
cluster ?
...
cluster ?
SUHUR#
cluster ?
...
cluster ?
face reverse
column 1
line 1
terminal=1
5(N14)
1(N01)
cluster ?
...
cluster ?
U2~a
line 2
terminal=1
quad
GI
&
GI
GU7
" ], "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
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'')#
prime=2
cluster ?
TAR~a
cluster ?
line 4
GU7
face reverse
comment
blank space
" ], "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", "\n", "
nptabletsignsignsignlinesigncasesignsigncasesignsign
1P448702 obverse:1:2P4487023(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
2P471695 obverse:2:1P4716952b1(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", "\n", "\n", "\n", "\n", "\n", "\n", "
nplinecasesignsign
1P448702 obverse:1:22a'[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
2P448702 obverse:1:22a'[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)
3P448702 obverse:1:22a'[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)
4P448702 obverse:1:22a'[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
5P448702 obverse:1:22a'[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)
6P448702 obverse:1:22a'[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)
7P448702 obverse:1:22a'[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": [ "

line 2
case 2a'
terminal=1
cluster ?
type=uncertain
N
type=numeral
cluster ?
type=uncertain
2(N14)
type=numeral
3(N01)
type=numeral
KASZ~b
type=ideograph
NUN~a
type=ideograph
case 2b'
terminal=1
3(N01)
type=numeral
KASZ~a?
type=ideograph
GI
type=ideograph
" ], "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
cluster ?
type=uncertain
N
type=numeral
cluster ?
type=uncertain
2(N14)
type=numeral
3(N01)
type=numeral
KASZ~b
type=ideograph
NUN~a
type=ideograph
case 2b'
number=2bterminal=1
3(N01)
type=numeral
KASZ~a?
type=ideograph
GI
type=ideograph
" ], "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": [ "
line 2
case 2a'
cluster ?
N
cluster ?
2(N14)
3(N01)
KASZ~b
NUN~a
case 2b'
3(N01)
KASZ~a?
GI
" ], "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": [ "
line 2
case 2a'
cluster ?
N
cluster ?
2(N14)
3(N01)
KASZ~b
NUN~a
case 2b'
3(N01)
KASZ~a?
GI
" ], "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": [ "
line 2
case 2a'
cluster ?
N
cluster ?
2(N14)
3(N01)
KASZ~b
NUN~a
case 2b'
3(N01)
KASZ~a?
GI
" ], "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": [ "
line 2
case 2a'
cluster ?
N
cluster ?
2(N14)
3(N01)
KASZ~b
NUN~a
case 2b'
3(N01)
KASZ~a?
GI
" ], "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": [ "
line 2
case 2a'
cluster ?
N
cluster ?
2(N14)
3(N01)
KASZ~b
NUN~a
case 2b'
3(N01)
KASZ~a?
GI
" ], "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": [ "
line 2
case 2a'
cluster ?
N
cluster ?
2(N14)
3(N01)
KASZ~b
NUN~a
case 2b'
3(N01)
KASZ~a?
GI
" ], "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": [ "

line 2
case 2a'
cluster ?
N
cluster ?
2(N14)
3(N01)
KASZ~b
NUN~a
case 2b'
3(N01)
KASZ~a?
GI
" ], "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", "\n", "\n", "\n", "\n", "\n", "
nptabletlinecasesignsign
1P448702 obverse:1:2P4487022a'[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
2P448702 obverse:1:2P4487022a'[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)
3P448702 obverse:1:2P4487022a'[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)
4P448702 obverse:1:2P4487022a'[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
5P448702 obverse:1:2P4487022a'[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)
6P448702 obverse:1:2P4487022a'[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", "
nptabletlinecasesignsign
1P448702 obverse:1:2P4487022a'[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": [ "
line 2
case 2a'
cluster ?
N
cluster ?
2(N14)
3(N01)
KASZ~b
NUN~a
case 2b'
3(N01)
KASZ~a?
GI
" ], "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", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
npcase
1P003357 obverse:1:11b1AEN~a ZATU759 DU
2P003357 obverse:1:11b1B3(N57) SU~a
3P003537 obverse:5:44b1A3(N57) X SZA U4 [...] X
4P003537 obverse:5:44b1BX X
5P003537 obverse:5:44b2A2(N57) GAN~b SZU [...]
6P003537 obverse:5:44b2BX [...]
7P003589 obverse:1:33b2A|GA~a.ZATU753|
8P003589 obverse:1:33b2BMUD [...]
9P003822 obverse:1:11a2A[...] [...]
10P003822 obverse:1:11a2B[...] 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", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
npcase
1P004735 obverse:2:11b1B1(NAB DI |BU~a+DU6~a|)a
2P004735 obverse:2:11b1B2(ZI~a#? AN)a
3P004735 obverse:2:11b1B3(ANSZE~e 7(N57) DUR2 DU)a
4P004735 obverse:2:11b1B4(LAL3~a#? GAR IG~b)a
5P004735 obverse:2:22b2B1(GI6 KISZIK~a# URI3~a)a
6P004735 obverse:2:22b2B2([...])a
7P218054 reverse:1:11a1A1[...] 5(N01) [...] UDU~a
8P218054 reverse:1:11a1A2[...] 7(N01) MASZ2
9P325754 reverse:1:11c2b11(N01) [...]
10P325754 reverse:1:11c2b21(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", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
npcase
1P004735 obverse:2:11b1B1(NAB DI |BU~a+DU6~a|)a
2P004735 obverse:2:11b1B2(ZI~a#? AN)a
3P004735 obverse:2:11b1B3(ANSZE~e 7(N57) DUR2 DU)a
4P004735 obverse:2:11b1B4(LAL3~a#? GAR IG~b)a
5P004735 obverse:2:22b2B1(GI6 KISZIK~a# URI3~a)a
6P004735 obverse:2:22b2B2([...])a
7P218054 reverse:1:11a1A1[...] 5(N01) [...] UDU~a
8P218054 reverse:1:11a1A2[...] 7(N01) MASZ2
9P325754 reverse:1:11c2b11(N01) [...]
10P325754 reverse:1:11c2b21(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", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
npcase
1P448702 obverse:1:22a'[N] 2(N14) 3(N01) KASZ~b NUN~a
2P448702 obverse:1:22b'3(N01) KASZ~a GI
3P471695 obverse:1:11a3(N01) APIN~a 3(N57) UR4~a
4P471695 obverse:1:22a1(N14) 2(N01) [...]
5P471695 obverse:2:11a1(N01) ISZ~a
6P482083 obverse:1:11a'[...] 1(N14) [...] SZE~a
7P482083 obverse:1:11b'[N] TAR~a
8P482083 obverse:1:22a'3(N01) SZE~a KASZ~b |U4x3(N01)|
9P482083 obverse:1:22b' 1(N42~a) 1(N25) TAR~a
10P006438 obverse:1:22aKU6~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", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
npcase
1P448702 obverse:1:22a'[N] 2(N14) 3(N01) KASZ~b NUN~a
2P448702 obverse:1:22b'3(N01) KASZ~a GI
3P471695 obverse:1:11a3(N01) APIN~a 3(N57) UR4~a
4P471695 obverse:1:22a1(N14) 2(N01) [...]
5P471695 obverse:2:11a1(N01) ISZ~a
6P482083 obverse:1:11a'[...] 1(N14) [...] SZE~a
7P482083 obverse:1:11b'[N] TAR~a
8P482083 obverse:1:22a'3(N01) SZE~a KASZ~b |U4x3(N01)|
9P482083 obverse:1:22b' 1(N42~a) 1(N25) TAR~a
10P006438 obverse:1:22aKU6~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": [ "

line:244724 1
cluster:210220 ?
67704 ...
cluster:210220 ?
quad:141950
quad:141951
67705 GI
&
67706 GI
x
67707 SZE3
67708 UR2
cluster:210221 ?
67709 ...
cluster:210221 ?
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

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

line:255152 3
quad:143120
quad:143121
110687 GI
&
110688 GI
x
110689 SZE3
110690 3(N57)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 3" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line:260576 2
131407 1(N48)#
131408 8(N34)#
quad:143672
quad:143673
131409 GI
&
131410 GI
x
131411 GISZ@t
131412 ZATU659#?
131413 USZ~a
131414 GU4#
" ], "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
67703
face:154869 obverse
column:186837 1
line:244724 1
cluster:210220 [...]
cluster:210220 [...]
quad:141950 |(GI&GI)xSZE3|
67708 UR2
cluster:210221 [...]
cluster:210221 [...]
line:244725 2
quad:141952 |SILA3~axDUG~a|
67712 MEN~a
67713 SUKKAL#?
67714 X
67715 X
cluster:210222 [...]
cluster:210222 [...]
" ], "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
110673
face:157130 obverse
column:190707 1
line:255146 1
110674 TUM~b#
cluster:220130 [...]
cluster:220130 [...]
line:255147 2
110676 SU~a
cluster:220131 [...]
cluster:220131 [...]
line:255148 3
110678 PIRIG~b1
110679 X
line:255149 4
110680 NA2~a#
cluster:220132 [...]
cluster:220132 [...]
column:190708 2
line:255150 1
110682 RU#?
cluster:220133 [...]
cluster:220133 [...]
line:255151 2
quad:143119 |BU~b.NA2~a|
110686 3(N57)
line:255152 3
quad:143120 |(GI&GI)xSZE3|
110690 3(N57)
column:190709 3
line:255153 1
cluster:220134 [...]
cluster:220134 [...]
110692 X
cluster:220135 [...]
cluster:220135 [...]
" ], "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
131402
face:158867 obverse
column:193298 1
line:260575 1
131403 1(N34)
131404 3(N14)
131405 2(N01)#
131406 SZE3
line:260576 2
131407 1(N48)#
131408 8(N34)#
quad:143672 |(GI&GI)xGISZ@t|
131412 ZATU659#?
131413 USZ~a
131414 GU4#
face:158868 reverse
column:193299 1
line:260577 1
cluster:225099 [...]
cluster:225099 [...]
cluster:225100 [...]
cluster:225100 [...]
131417 EN~a#?
" ], "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": [ "\n", "\n", "\n", "\n", "\n", "
nptabletsignsign
1P448702 obverse:2:1143892 P44870275 U4 76 U4
2P448703 obverse:1:4143893 P44870397 U4 100 U4 87 U4 90 U4 93 U4
3P471695 obverse:1:1143894 P471695114 ZATU759 140 GIR3~c 111 UR4~a
4P482082 obverse:1:2143895 P482082155 ZATU694~c
5P482083 obverse:1:2143896 P482083169 U4
" ], "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", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
nptabletfacecolumnlinesign
1P448702 obverse:2:1P448702obverseP448702 obverse:2U4 |U4x1(N01)| SAG SUKUD@h NA U4
2P448702 obverse:2:1P448702obverseP448702 obverse:2U4 |U4x1(N01)| SAG SUKUD@h NA U4
3P448703 obverse:1:1P448703obverseP448703 obverse:1|U4.1(N08)| X U4
4P448703 obverse:1:2P448703obverseP448703 obverse:1|U4.1(N08)| GI U4
5P448703 obverse:1:3P448703obverseP448703 obverse:1|U4.1(N08)| |GI&GI| U4
6P448703 obverse:1:4P448703obverseP448703 obverse:1|U4.1(N08)| X U4
7P448703 obverse:1:5P448703obverseP448703 obverse:1|U4.1(N08)| X U4
8P471695 obverse:1:1P471695obverseP471695 obverse:11a3(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
9P471695 obverse:1:1P471695obverseP471695 obverse:11a3(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
10P471695 obverse:2:1P471695obverseP471695 obverse:21a1(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": [ "\n", "\n", "\n", "\n", "\n", "
nptabletcasesign
1P003617 obverse:2:2P0036172bSZITA~a1 BU~a SZITA~a1
2P003499 obverse:1:2P0034992aGAL~a SZITA~a1 SZITA~a1
3P003541 obverse:2:1P0035411bGESZTU~b SZITA~a1 ZATU686~a SZITA~a1
4P003593 obverse:5:2P0035932a[...] GADA~a SZITA~a1 X SZITA~a1
5P003593 obverse:5:3P0035933bGESZTU~b SZITA~a1 ZATU686~a SZITA~a1
" ], "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
comment
atf: lang qpc
face obverse
column 1
line 1
cluster ?
...
cluster ?
X
X
column 2
line 1
3(N14)
X
SANGA~a?
cluster ?
...
cluster ?
" ], "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
comment
atf: lang qpc
face obverse
column 1
line 1
X
X
line 2
X
X
column 2
line 1
X
X
line 2
X
X
column 3
line 1
X
X
line 2
3(N14)
X
line 3
1(N14)
SUHUR
line 4
X
X
line 5
1(N01)
quad
DUG~b
x
1(N57)
line 6
X
X
line 7
X
X
column 4
line 1
X
X
line 2
X
X
column 5
line 1
cluster ?
...
cluster ?
" ], "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
comment
atf: lang qpc
face obverse
column 1
line 1
case 1a
3(N01)
APIN~a
3(N57)
UR4~a
case 1b
case 1b1
cluster =
EN~a
DU
ZATU759
cluster =
case 1b2
cluster =
BAN~b
KASZ~c
cluster =
case 1b3
cluster =
KI@n
SAG
cluster =
line 2
case 2a
1(N14)
2(N01)
cluster ?
...
cluster ?
case 2b
case 2b1
cluster =
3(N57)
PAP~a
cluster =
case 2b2
comment
n lines broken
cluster =
SZU
KI
X
cluster =
case 2b3'
cluster =
EN~a
AN
EZINU~d
cluster =
case 2b4'
comment
rest broken
comment
(for a total of 12 sub-cases with PNN)
cluster =
IDIGNA
cluster ?
...
cluster ?
cluster =
column 2
line 1
case 1a
1(N01)
ISZ~a#?
case 1b
case 1b1
comment
blank space
comment
rest broken
cluster =
PAP~a
GIR3~c
cluster =
face reverse
comment
beginning broken
column 0
line 1
cluster ?
1(N14)
cluster ?
6(N01)#
cluster ?
...
cluster ?
" ], "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
comment
atf: lang qpc
face obverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
case 2a
KU6~a
BU~a
case 2b
quad
AB~a
x
SUKKAL
case 2c
NAM2
RAD~a
PA~a
SZU
case 2d
RAD~a
cluster ?
...
cluster ?
line 3
cluster ?
...
cluster ?
face reverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
1(N01)
USZ~a
SZUBUR
GAL~a
IM~a
line 3
SZA
cluster ?
...
cluster ?
RAD~a#
line 4
cluster ?
...
cluster ?
cluster ?
...
cluster ?
column 2
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
EN~a
LAL2~a#?
NIM~b2#?
cluster ?
...
cluster ?
" ], "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
comment
atf: lang qpc
face obverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
case 2a
KU6~a
BU~a
case 2b
quad
AB~a
x
SUKKAL
case 2c
NAM2
RAD~a
PA~a
SZU
case 2d
RAD~a
cluster ?
...
cluster ?
line 3
cluster ?
...
cluster ?
face reverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
1(N01)
USZ~a
SZUBUR
GAL~a
IM~a
line 3
SZA
cluster ?
...
cluster ?
RAD~a#
line 4
cluster ?
...
cluster ?
cluster ?
...
cluster ?
column 2
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
EN~a
LAL2~a#?
NIM~b2#?
cluster ?
...
cluster ?
" ], "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
comment
atf: lang qpc
face obverse
column 1
line 1
case 1a
cluster ?
...
cluster ?
cluster ?
...
cluster ?
GAL~a#
case 1b
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
cluster ?
...
cluster ?
cluster ?
...
cluster ?
PAP~a#?
" ], "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
comment
atf: lang qpc
face obverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
case 2a
KU6~a
BU~a
case 2b
quad
AB~a
x
SUKKAL
case 2c
NAM2
RAD~a
PA~a
SZU
case 2d
RAD~a
cluster ?
...
cluster ?
line 3
cluster ?
...
cluster ?
face reverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
1(N01)
USZ~a
SZUBUR
GAL~a
IM~a
line 3
SZA
cluster ?
...
cluster ?
RAD~a#
line 4
cluster ?
...
cluster ?
cluster ?
...
cluster ?
column 2
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
EN~a
LAL2~a#?
NIM~b2#?
cluster ?
...
cluster ?
" ], "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
comment
atf: lang qpc
face obverse
column 1
line 1
1(N01)#
BA#
SUHUR#
SAG
line 2
2(N01)#
BA#
SUHUR
line 3
1(N14)#
X
SUHUR#
line 4
1(N01)#
SUMASZ
X
column 2
line 1
1(N34)
quad
ZATU759
x
KU6~a
line 2
UB
KU6~a
line 3
case 3a
X
EN~a#
X
case 3b
case 3b1
SUHUR#
X
case 3b2
TUR3~a#
DU#
SZE3#
face reverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
column 2
line 1
quad
GI
&
GI
GIR3~a#?
SUHUR#
" ], "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
comment
atf: lang qpc
face obverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
case 2a
KU6~a
BU~a
case 2b
quad
AB~a
x
SUKKAL
case 2c
NAM2
RAD~a
PA~a
SZU
case 2d
RAD~a
cluster ?
...
cluster ?
line 3
cluster ?
...
cluster ?
face reverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
1(N01)
USZ~a
SZUBUR
GAL~a
IM~a
line 3
SZA
cluster ?
...
cluster ?
RAD~a#
line 4
cluster ?
...
cluster ?
cluster ?
...
cluster ?
column 2
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
EN~a
LAL2~a#?
NIM~b2#?
cluster ?
...
cluster ?
" ], "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
comment
atf: lang qpc
face obverse
column 1
line 1
1(N01)#
BA#
SUHUR#
SAG
line 2
2(N01)#
BA#
SUHUR
line 3
1(N14)#
X
SUHUR#
line 4
1(N01)#
SUMASZ
X
column 2
line 1
1(N34)
quad
ZATU759
x
KU6~a
line 2
UB
KU6~a
line 3
case 3a
X
EN~a#
X
case 3b
case 3b1
SUHUR#
X
case 3b2
TUR3~a#
DU#
SZE3#
face reverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
column 2
line 1
quad
GI
&
GI
GIR3~a#?
SUHUR#
" ], "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 }