{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "\n", "# Calc\n", "\n", "We show a tablet calculator: a program that sums up the numerical value of both sides of a tablet and compares them.\n", "\n", "We assume that you have worked through the [search](search.ipynb) notebook." ] }, { "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: ~/text-fabric-data/github/Nino-cunei/uruk/app" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "data: ~/text-fabric-data/github/Nino-cunei/uruk/tf/1.0" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " Text-Fabric: Text-Fabric API 12.0.7, 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", " Settings:
specified
  1. apiVersion: 3
  2. appName: Nino-cunei/uruk
  3. appPath: /Users/me/text-fabric-data/github/Nino-cunei/uruk/app
  4. commit: 7da6cb7cd9dffb12aff5e35639078029727a90e7
  5. css:.contnr.cluster {
    flex-flow: row wrap;
    border: 0;
    }
    .meta .features {
    background-color: #ffeedd;
    }
    .lbl.clusterb,.lbl.clustere {
    padding: 0.5em 0.1em 0.1em 0.1em;
    margin: 0.8em 0.1em 0.1em 0.1em;
    color: #888844;
    font-size: x-small;
    }
    .lbl.clusterb {
    border-left: 0.3em solid #cccc99;
    border-right: 0;
    border-top: 0;
    border-bottom: 0;
    border-radius: 1rem;
    }
    .lbl.clustere {
    border-left: 0;
    border-right: 0.3em solid #cccc99;
    border-top: 0;
    border-bottom: 0;
    border-radius: 1rem;
    }
    .op {
    padding: 0.5em 0.1em 0.1em 0.1em;
    margin: 0.8em 0.1em 0.1em 0.1em;
    font-family: monospace;
    font-size: x-large;
    font-weight: bold;
    }
    .period {
    font-family: monospace;
    font-size: medium;
    font-weight: bold;
    color: #0000bb;
    }
    .excavation {
    font-family: monospace;
    font-size: medium;
    font-style: italic;
    color: #779900;
    }
  6. dataDisplay:
    • browseContentPretty: True
    • browseNavLevel: 1
    • showVerseInTuple: True
  7. docs:
    • docPage: about
    • featureBase: {docBase}/transcription{docExt}
    • featurePage: ''
  8. interfaceDefaults:
    • lineNumbers: 0
    • showGraphics: True
    • standardFeatures: True
  9. isCompatible: True
  10. local: local
  11. localDir: /Users/me/text-fabric-data/github/Nino-cunei/uruk/_temp
  12. provenanceSpec:
    • corpus: Uruk IV/III: Proto-cuneiform tablets
    • doi: 10.5281/zenodo.1193841
    • graphicsRelative: sources/cdli/images
    • org: Nino-cunei
    • relative: /tf
    • repo: uruk
    • version: 1.0
    • webBase: https://cdli.ucla.edu
    • webHint: to CDLI main page for this tablet
    • webUrl:{webBase}/search/search_results.php?SearchMode=Text&ObjectID=<1>
  13. release: no value
  14. typeDisplay:
    • case:
      • children:
        • cluster
        • comment
        • quad
        • sign
      • flow: hor
      • label: {number}{prime}
      • level: 2
      • lineNumber: srcLnNum
      • stretch: 0
      • template: {number}{prime}
      • transform: {prime: prime}
      • wrap: 0
    • cluster:
      • children:
        • cluster
        • quad
        • sign
      • label: {type}
      • stretch: 0
      • template: {type}
      • transform: {type: ctype}
    • column:
      • children:
        • comment
        • line
      • flow: ver
      • isBig: True
      • label: {number}{prime}
      • level: 3
      • lineNumber: srcLnNum
      • transform: {prime: prime}
    • comment:
      • base: True
      • featuresBare: text
      • label: {type}
      • lineNumber: srcLnNum
    • face:
      • children:
        • column
        • comment
      • featuresBare: identifier fragment
      • flow: hor
      • isBig: True
      • label: {type}
      • lineNumber: srcLnNum
      • stretch: 0
      • template: {type}
      • wrap: 0
    • line:
      • children:
        • case
        • cluster
        • comment
        • quad
        • sign
      • flow: hor
      • label: {number}
      • level: 2
      • lineNumber: srcLnNum
      • stretch: 0
      • transform: {prime: prime}
      • wrap: 0
    • quad:
      • children:
        • cluster
        • quad
        • sign
      • graphics: True
      • stretch: 0
    • sign:
      • base: True
      • graphics: True
      • label: {atf}
      • transform: {atf: atf}
    • tablet:
      • children:
        • comment
        • face
      • condense: True
      • featuresBare: name period excavation
      • flow: ver
      • isBig: True
      • lineNumber: srcLnNum
      • stretch: 0
      • wrap: 0
\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 Fs Fall Es Eall Cs Call directly usable

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "data: ~/text-fabric-data/github/Nino-cunei/uruk/sources/cdli/images" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Found 2095 ideograph linearts
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Found 2724 tablet linearts
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Found 5495 tablet photos
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A = use(\"Nino-cunei/uruk\",hoist=globals())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Numerals\n", "\n", "We want to find all the ShinPP numerals." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2018-05-24T10:19:30.299882Z", "start_time": "2018-05-24T10:19:30.293081Z" } }, "outputs": [], "source": [ "shinPP = dict(\n", " N41=0.2,\n", " N04=1,\n", " N19=6,\n", " N46=60,\n", " N36=180,\n", " N49=1800,\n", ")\n", "\n", "shinPPPat = \"|\".join(shinPP)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We make use of the fact that we can construct a search template programmatically." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2018-05-24T10:19:34.187667Z", "start_time": "2018-05-24T10:19:33.939900Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "tablet\n", " sign grapheme=N41|N04|N19|N46|N36|N49\n", "\n", " 0.07s 1018 results\n" ] }, { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
nptabletsign
1P448701 obverse:1:1P4487011(N46)
2P448701 obverse:1:1P4487012(N19)
3P448701 obverse:1:1P4487014(N41)
4P006005 obverse:2:1P0060051(N04)
5P002329 obverse:1:5P0023292(N19)
6P002342 obverse:3:2P0023421(N36)
7P002342 obverse:3:2P0023422(N19)
8P002344 obverse:3:3P0023441(N04)
9P002398 obverse:2:3P0023981(N04)
10P002622 obverse:1:1P0026225(N19)
11P002622 obverse:2:1P0026221(N46)
12P002622 obverse:2:1P0026224(N19)
13P002626 obverse:1:2P0026261(N41)
14P003330 reverse:1:1P0033303(N46)
15P003330 reverse:1:1P0033302(N49)
16P003330 reverse:1:1P0033305(N19)
17P003330 reverse:1:1P0033302(N04)
18P003330 reverse:1:1P0033301(N41)
19P003357 obverse:1:2P0033571(N04)
20P003542 obverse:2:5P0035421(N04)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "query = f\"\"\"\n", "tablet\n", " sign grapheme={shinPPPat}\n", "\"\"\"\n", "print(query)\n", "results = A.search(query)\n", "A.table(results, end=20, showGraphics=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's see a few tablets in more detail:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2018-05-24T10:19:36.982430Z", "start_time": "2018-05-24T10:19:36.884981Z" } }, "outputs": [ { "data": { "text/html": [ "

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

tablet P448701
Anonymous 448701uruk-iii
comment
atf: lang qpc
face obverse
column 1
line 1
1(N46)
2(N19)
4(N41)
line 2
AB~a
APIN~a
NUN~a
X
X
column 2
line 1
X
X
line 2
SZE~a
DU
NUN~a
face reverse
comment
(not imaged)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

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

tablet P448701
Anonymous 448701uruk-iii
comment
atf: lang qpc
face obverse
column 1
line 1
1(N46)
2(N19)
4(N41)
line 2
AB~a
APIN~a
NUN~a
X
X
column 2
line 1
X
X
line 2
SZE~a
DU
NUN~a
face reverse
comment
(not imaged)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

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

tablet P448701
Anonymous 448701uruk-iii
comment
atf: lang qpc
face obverse
column 1
line 1
1(N46)
2(N19)
4(N41)
line 2
AB~a
APIN~a
NUN~a
X
X
column 2
line 1
X
X
line 2
SZE~a
DU
NUN~a
face reverse
comment
(not imaged)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

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

tablet P006005
ATU 6, pl. 052, W 14731,ag07uruk-iiiW 14731,ag07
comment
atf: lang qpc
face obverse
column 1
line 1
cluster ?
...
cluster ?
X
X
cluster ?
...
cluster ?
line 2
cluster ?
...
cluster ?
X
X
cluster ?
...
cluster ?
column 2
line 1
cluster ?
...
cluster ?
1(N04)#
PAP~a#?
cluster ?
...
cluster ?
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

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

tablet P002329
ATU 6, pl. 065, W 15774,duruk-iiiW 15774,d
comment
atf: lang qpc
face obverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
KI
NUNUZ~a1
line 2
cluster ?
...
cluster ?
cluster ?
...
cluster ?
SANGA~a#
1(N57)
BA
EN~a
line 3
cluster ?
...
cluster ?
cluster ?
...
cluster ?
BA#?
NAGAR~b
line 4
cluster ?
...
cluster ?
cluster ?
...
cluster ?
SZU2
SAL
line 5
case 5a
cluster ?
...
cluster ?
1(N14)#
cluster ?
...
cluster ?
cluster ?
...
cluster ?
case 5b
2(N19)#
cluster ?
...
cluster ?
cluster ?
...
cluster ?
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.show(results, end=5, queryFeatures=False)" ] }, { "cell_type": "markdown", "metadata": { "tags": [] }, "source": [ "# A tablet calculator\n", "\n", "Rather than displaying search results, you can also *process* them in your program.\n", "\n", "Search results come as tuples of nodes that correspond directly to the elements\n", "of your search template.\n", "\n", "We query for shinPP numerals on the faces of tablets.\n", "The result of the query is a list of tuples `(t, f, s)` consisting of\n", "a tablet node, a face node and a node for a sign of a shinPP numeral.\n", "\n", "## Rationale\n", "This task will require a higher level of programming skills and a deeper knowledge of how\n", "Python works.\n", "We include it in this tutorial to get the message across that Text-Fabric is not\n", "a black box that shields you from your data. Everything you handle in Text-Fabric is\n", "open to further programming and processing of your own design and choosing." ] }, { "cell_type": "markdown", "metadata": { "tags": [] }, "source": [ "## Data collection" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2018-05-24T10:19:42.344356Z", "start_time": "2018-05-24T10:19:42.097434Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.08s 1018 results\n" ] } ], "source": [ "query = f\"\"\"\n", "tablet\n", " face\n", " sign type=numeral grapheme={shinPPPat}\n", "\"\"\"\n", "results = A.search(query)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We are going to put all these numerals in buckets: for each face on each tablet a separate bucket." ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2018-05-24T10:19:44.413172Z", "start_time": "2018-05-24T10:19:44.404041Z" }, "lines_to_next_cell": 2 }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "235 tablets\n", "P448701\n", "P006005\n", "P002329\n", "P002342\n", "P002344\n", "P002398\n", "P002622\n", "P002626\n", "P003330\n", "P003357\n", "...\n" ] } ], "source": [ "numerals = {}\n", "pNums = {}\n", "for (tablet, face, sign) in results:\n", " pNums[F.catalogId.v(tablet)] = tablet\n", " numerals.setdefault(tablet, {}).setdefault(face, []).append(sign)\n", "print(f\"{len(pNums)} tablets\")\n", "print(\"\\n\".join(list(pNums)[0:10]))\n", "print(\"...\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The calculator\n", "We define a function that given a tablet, adds the shinPP numerals by its faces.\n", "We also show the line art and a pretty transcription.\n", "\n", "The function is a bit involved." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2018-05-24T10:19:46.415859Z", "start_time": "2018-05-24T10:19:46.406051Z" } }, "outputs": [], "source": [ "# we generate Markdown strings and send them to the notebook formatter\n", "\n", "\n", "def dm(x):\n", " display(Markdown(x))\n", "\n", "\n", "def calcTablet(pNum): # pNum identifies the tablet in question\n", " # show a horizontal line in Markdown\n", " dm(\"---\\n\")\n", " tablet = pNums.get(pNum, None) # look up the node for this p-number\n", " if tablet is None:\n", " dm(f\"**no results for {pNum}**\")\n", " return # if not found the tablet has no ShinPP numerals: quit\n", "\n", " A.lineart(tablet, withCaption=\"top\", width=\"200\") # show lineart\n", " faces = numerals[tablet] # get the buckets for the faces\n", " mySigns = []\n", " for (face, signs) in faces.items(): # work per face\n", " mySigns.extend(signs)\n", " dm(f\"### {F.type.v(face)}\") # show the name of the face\n", " distinctSigns = {} # collect the distinct numerals\n", " for s in signs:\n", " distinctSigns.setdefault(A.atfFromSign(s), []).append(s)\n", " A.lineart(distinctSigns) # display the list of signs\n", " total = 0 # start adding up\n", " for (signAtf, signs) in distinctSigns.items():\n", " value = 0\n", " for s in signs:\n", " value += F.repeat.v(s) * shinPP[F.grapheme.v(s)]\n", " total += value\n", " amount = len(signs) # we report our calculation\n", " shinPPval = shinPP[F.grapheme.v(signs[0])]\n", " repeat = F.repeat.v(signs[0])\n", " print(f\"{amount} x {signAtf} = {amount} x {repeat} x {shinPPval} = {value}\")\n", " dm(f\"**total** = **{total}**\")\n", " A.prettyTuple(\n", " [tablet] + mySigns, 1, queryFeatures=False\n", " ) # show pretty transcription" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Calculate once" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2018-05-24T10:19:48.478383Z", "start_time": "2018-05-24T10:19:48.377669Z" } }, "outputs": [ { "data": { "text/markdown": [ "---\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "### obverse" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "1 x 1(N46) = 1 x 1 x 60 = 60\n", "1 x 5(N19) = 1 x 5 x 6 = 30\n", "4 x 3(N04) = 4 x 3 x 1 = 12\n", "2 x 1(N41) = 2 x 1 x 0.2 = 0.4\n", "8 x 1(N19) = 8 x 1 x 6 = 48\n", "2 x 3(N19) = 2 x 3 x 6 = 36\n", "5 x 1(N04) = 5 x 1 x 1 = 5\n", "3 x 2(N04) = 3 x 2 x 1 = 6\n", "3 x 2(N19) = 3 x 2 x 6 = 36\n", "1 x 2(N41) = 1 x 2 x 0.2 = 0.4\n", "2 x 4(N04) = 2 x 4 x 1 = 8\n", "1 x 3(N41) = 1 x 3 x 0.2 = 0.6000000000000001\n", "1 x 4(N19) = 1 x 4 x 6 = 24\n" ] }, { "data": { "text/markdown": [ "**total** = **266.4**" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "### reverse" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "1 x 1(N36) = 1 x 1 x 180 = 180\n", "1 x 1(N46) = 1 x 1 x 60 = 60\n", "1 x 8(N19) = 1 x 8 x 6 = 48\n", "1 x 5(N04) = 1 x 5 x 1 = 5\n", "1 x 3(N41) = 1 x 3 x 0.2 = 0.6000000000000001\n" ] }, { "data": { "text/markdown": [ "**total** = **293.6**" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

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

tablet P006377
CUSAS 01, 105uruk-iii
comment
atf: lang qpc
face obverse
column 1
line 1
case 1a
1(N46)
5(N19)#
3(N04)#
1(N41)
UR5~a
case 1b
1(N19)#
3(N04)#
1(N41)
1(N24)
TAR~a
line 2
3(N04)
SAL
TUR3~a
line 3
1(N19)
SAL
ZATU788
AN
NUNUZ~a1
line 4
3(N19)
quad
U4
x
quad
1(N14)
.
1(N01)
KASZ~b
AB~a
line 5
1(N04)
quad
1(N57)
.
SZUBUR
TUR3~a
ME~a
line 6
2(N04)
SANGA~a#
SANGA~a#
ZATU788
AN
NUNUZ~a1
line 7
3(N04)
SAL
ZATU788
AN
NUNUZ~a1
line 8
3(N19)
HI
ASAR
UNUG~a
line 9
2(N19)
quad
1(N57)
.
SZUBUR
TUR3~a
ME~a
column 2
line 1
1(N19)#
ZATU788#
AN#
NUNUZ~a1
line 2
1(N04)
SAL
ZATU676~b
line 3
1(N19)
SANGA~a
TUR3~a
line 4
2(N19)
2(N41)
EN~a
GA2~a1
DU
SZU
line 5
1(N19)
4(N04)
3(N41)
1(N24~b)
SZIM~a
SZU
I
BU~a
line 6
1(N04)
USZ~a
3(N57)
line 7
1(N14)
SAL
SANGA~a
TUR3~a
line 8
1(N14)
LUGAL
line 9
1(N19)#
3(N01)
AN
TE
GA2~b
line 10
1(N04)
TA~c
SAL
HI
UNUG~a
column 3
line 1
4(N19)#
SANGA~a
SANGA~a
GAL~a
line 2
2(N04)
ME~a
UR~a
KU3~a#
KI#
line 3
1(N19)
1(N57)
NIN
ZATU788
AN
NUNUZ~a1
line 4
4(N04)
NIN
ZATU788
AN
NUNUZ~a1
line 5
1(N04)
BA
NI~a
line 6
2(N04)#
ZI~a
SZU
line 7
2(N19)
ZATU788
AN
NUNUZ~a1
line 8
1(N14)
ZATU811
MUSZ3~a
ZATU809
line 9
1(N14)
DU
BU~a
line 10
1(N19)
TUR3~a#
ME~a
face reverse
column 1
line 1
1(N36)
1(N46)
8(N19)
5(N04)
3(N41)
GU7
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "calcTablet(\"P006377\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Calculate ad lib\n", "Now the first 5 tablets." ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "ExecuteTime": { "end_time": "2018-05-24T10:19:52.590763Z", "start_time": "2018-05-24T10:19:52.327850Z" } }, "outputs": [ { "data": { "text/markdown": [ "---\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "### obverse" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "1 x 1(N04) = 1 x 1 x 1 = 1\n" ] }, { "data": { "text/markdown": [ "**total** = **1**" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

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

tablet P000266
CDLI Lexical 000019, ex. 003uruk-iiiW 20266,020
comment
atf: lang qpc
face obverse
comment
beginning broken
column 1'
comment
beginning broken
line 1
cluster ?
1(N01)
cluster ?
cluster ?
...
cluster ?
IM~a#?
line 2
cluster ?
1(N01)
cluster ?
cluster ?
...
cluster ?
IM~a#?
line 3
comment
rest broken
cluster ?
1(N01)
cluster ?
cluster ?
...
cluster ?
GAN2#?
column 2'
comment
beginning broken
line 1
cluster ?
1(N01)
cluster ?
DU7#
X
cluster ?
...
cluster ?
line 2
1(N01)#
X
IM~a
AD~a
line 3
1(N01)
quad
BU~a
+
DU6~a
2(N57)
line 4
1(N01)
SAR~c
HI
line 5
1(N01)
GI6
1(N04)
line 6
1(N01)
TUR
quad
SZE~a
&
SZE~a
line 7
1(N01)#
SUKKAL
E2~a
LU2#
line 8
cluster ?
1(N01)
cluster ?
DA~a#
cluster ?
...
cluster ?
face reverse
column 0
line 1
cluster ?
N
cluster ?
cluster ?
...
cluster ?
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "---\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "### obverse" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "2 x 1(N36) = 2 x 1 x 180 = 360\n" ] }, { "data": { "text/markdown": [ "**total** = **360**" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "### reverse" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "1 x 3(N36) = 1 x 3 x 180 = 540\n" ] }, { "data": { "text/markdown": [ "**total** = **540**" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

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

tablet P001043
ATU 5, pl. 037, W 9123,vuruk-ivW 09123,v
comment
atf: lang qpc
face obverse
column 1
line 1
cluster ?
...
cluster ?
1(N36)
cluster ?
...
cluster ?
NESAG2~a#
TE#
line 2
1(N36)
GI
AL
face reverse
column 1
line 1
3(N36)#
cluster ?
...
cluster ?
AN#
cluster ?
...
cluster ?
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "---\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "### obverse" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "1 x 5(N36) = 1 x 5 x 180 = 900\n", "4 x 1(N46) = 4 x 1 x 60 = 240\n", "2 x 1(N36) = 2 x 1 x 180 = 360\n", "1 x 2(N46) = 1 x 2 x 60 = 120\n", "1 x 1(N04) = 1 x 1 x 1 = 1\n", "1 x 1(N19) = 1 x 1 x 6 = 6\n", "2 x 2(N36) = 2 x 2 x 180 = 720\n", "1 x 2(N19) = 1 x 2 x 6 = 12\n" ] }, { "data": { "text/markdown": [ "**total** = **2359**" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

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

tablet P001270
ATU 5, pl. 065, W 9579,wuruk-ivW 09579,w
comment
atf: lang qpc
face obverse
column 1
line 1
9(N34)#
1(N45)#
7(N14)#
3(N01)#
X
line 2
5(N36)#
1(N46)#
2(N14)
3(N01)#
X
line 3
1(N36)
2(N46)
1(N04)#
quad
DU8~c
x
HI
column 2
line 1
1(N46)#
1(N19)#
cluster ?
...
cluster ?
2(N01)#
GI#
line 2
2(N36)#
1(N46)#
2(N19)#
2(N01)#?
GI#
line 3
2(N36)#
1(N46)#
cluster ?
...
cluster ?
1(N01)#
X
cluster ?
...
cluster ?
line 4
1(N36)#
8(N14)#
1(N01)#
DA~c
U4#
cluster ?
...
cluster ?
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "---\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "### obverse" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "1 x 1(N04) = 1 x 1 x 1 = 1\n" ] }, { "data": { "text/markdown": [ "**total** = **1**" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

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

tablet P002260
IM 023435,14uruk-iiiW 15771,d
comment
atf: lang qpc
face obverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
GU#
NUN~a
line 2
cluster ?
...
cluster ?
3(N01)
1(N04)
NAM2
cluster ?
...
cluster ?
line 3
cluster ?
...
cluster ?
3(N01)
EN~a#
X
PA~a#
line 4
cluster ?
...
cluster ?
1(N01)
X
X
cluster ?
...
cluster ?
column 2
line 1
cluster ?
...
cluster ?
2(N01)
cluster ?
...
cluster ?
line 2
2(N01)
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 3
1(N01)
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 4
cluster ?
...
cluster ?
5(N01)?
cluster ?
...
cluster ?
column 3
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
1(N01)
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 3
2(N01)
cluster ?
...
cluster ?
cluster ?
...
cluster ?
face reverse
column 1
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
X
line 2
cluster ?
...
cluster ?
3(N01)#
X
cluster ?
...
cluster ?
line 3
cluster ?
...
cluster ?
cluster ?
...
cluster ?
X
column 2
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
line 2
2(N01)
ZATU773~a
PAP~a
line 3
1(N01)
GA~a
KU3~a
GAL~a#
cluster ?
...
cluster ?
column 3
line 1
cluster ?
...
cluster ?
cluster ?
...
cluster ?
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "---\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "### obverse" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "1 x 1(N36) = 1 x 1 x 180 = 180\n" ] }, { "data": { "text/markdown": [ "**total** = **180**" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

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

tablet P002275
IM 023435,06uruk-iiiW 15771,t
comment
atf: lang qpc
face obverse
column 1
line 1
case 1a
cluster ?
...
cluster ?
cluster ?
...
cluster ?
X
case 1b
2(N45)
SZE~a
line 2
case 2a
cluster ?
...
cluster ?
4(N14)#
cluster ?
...
cluster ?
case 2b
1(N36)
1(N45)
2(N14)
cluster ?
...
cluster ?
cluster ?
...
cluster ?
column 2
line 1
case 1a
1(N50)
8(N14)
SANGA~a#
ZATU753#
cluster ?
...
cluster ?
case 1b
7(N14)
SZE~a
cluster ?
...
cluster ?
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for tablet in sorted(pNums)[0:5]:\n", " calcTablet(tablet)" ] }, { "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", "[signs](signs.ipynb)\n", "\n", "*Back to the basics ...*\n", "\n", "All chapters:\n", "[start](start.ipynb)\n", "[imagery](imagery.ipynb)\n", "[steps](steps.ipynb)\n", "[search](search.ipynb)\n", "**calc**\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.12.0" }, "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 }