1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
|
%global _empty_manifest_terminate_build 0
Name: python-akkadian
Version: 1.0.12
Release: 1
Summary: Translating Akkadian signs to transliteration using NLP algorithms
License: MIT License
URL: https://github.com/gaigutherz/Akkademia
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/53/1e/e7fb20d6c3de56bf1b2d0e10d735d78c239354e31d9309a521578864e8d7/akkadian-1.0.12.tar.gz
BuildArch: noarch
Requires: python3-allennlp
%description
# Akkademia
Akkademia is a tool for automatically transliterating Unicode cuneiform glyphs. It is written in python script and uses HMM, MEMM and BiLSTM neural networks to determine appropriate sign-readings and segmentation.
We trained these algorithms on the RINAP corpora (Royal Inscriptions of the Neo-Assyrian Period), which are available in JSON and XML/TEI formats thanks to the efforts of the Official Inscriptions of the Middle East in Antiquity (OIMEA) Munich Project of Karen Radner and Jamie Novotny, funded by the Alexander von Humboldt Foundation, available [here](<http://oracc.org/rinap/>). We achieve accuracy rates of 89.5% with HMM, 94% with MEMM, and 96.7% with BiLSTM on the trained corpora. Our model can also be used on texts from other periods and genres, with varying levels of success.
## Getting Started
Akkademia can be accessed in three different ways:
* Website
* Python package
* Github clone
The website and python package are meant to be accessible to people without advanced programming knowledge.
## Website
Go to the [Babylonian Engine website](<https://babylonian.herokuapp.com/>) (*under development*)
Go to the "Akkademia" tab and follow the instructions there for transliterating your signs.
## Python Package
Our python package "akkadian" will enable you to use Akkademia on your local machine.
### Prerequisites
You will need a Python 3.7.x installed. Our package currently does not work with other versions of python. You can follow the installation instructions [here](<https://realpython.com/installing-python/>) or go straight ahead to [python's downloads page](<https://www.python.org/downloads/>) and pick an appropriate version.
Mac comes preinstalled with python 2.7, which may remain the default python version even after installing 3.7.x. To check, type ``python --version`` into terminal. If the running version is python 2.7, the simplest short-term solution is to type ``python3`` or ``pip3`` in Terminal throughout instead of ``python`` and ``pip`` as in the instructions below.
### Package Installation
You can install the package using the pip install function. If you do not have pip installed on your computer, or you are not sure whether it is installed or not, you can follow the instructions [here](<https://www.makeuseof.com/tag/install-pip-for-python/>)
Before installing the package akkadian, you will need to install the torch package. For Windows, copy the following into Command Prompt (CMD):
```
pip install torch==1.0.0 torchvision==0.2.1 -f https://download.pytorch.org/whl/torch_stable.html
```
For Mac and Linux copy the following into Terminal:
```
pip install torch torchvision
```
Then, type the following in Command Prompt (Windows), or Terminal (Mac and Linux):
```
pip install akkadian
```
your installation should be executed. This will take several minutes.
### Running
Open a python IDE (Integrated development environment) where a python code can be run. There are many possible IDEs, see [realpython's guide](<https://realpython.com/python-ides-code-editors-guide/>) or [wiki python's list](<https://wiki.python.org/moin/IntegratedDevelopmentEnvironments>). For beginners, we recommend using Jupyter Notebook: see downloading instructions [here](<https://jupyter.org/install>), or see downloading instructions and beginners' tutorial [here](<https://realpython.com/jupyter-notebook-introduction/>).
First, import ```akkadian.transliterate``` into your coding environment:
```
import akkadian.transliterate as akk
```
Then, you can use HMM, MEMM, or BiLSTM to transliterate the signs. The functions are:
```
akk.transliterate_hmm("Unicode_signs_here")
akk.transliterate_memm("Unicode_signs_here")
akk.transliterate_bilstm("Unicode_signs_here")
akk.transliterate_bilstm_top3("Unicode_signs_here")
```
```akk.transliterate_bilstm_top3``` gives the top three BiLSTM options, while ```akk.transliterate_bilstm``` gives only the top one.
For an immediate output of the results, put the ```akk.transliterate()``` function inside the ```print()``` function. Here are some examples with their output:
```
print(akk.transliterate_hmm("π»π
ππΏπ¬ππ
π²π ππΎ"))
Ε‘aβ nak-ba-i-mu-ru iΕ‘-di-ma-a-ti
```
```
print(akk.transliterate_memm("π»π
ππΏπ¬ππ
π²π ππΎ"))
Ε‘aβ SILIM ba-i-mu-ru-iΕ‘-di-ma-a-ti
```
```
print(akk.transliterate_bilstm("π»π
ππΏπ¬ππ
π²π ππΎ"))
Ε‘aβ nak-ba-i-mu-ru iΕ‘-di-ma-a-ti
```
```
print(akk.transliterate_bilstm_top3("π»π
ππΏπ¬ππ
π²π ππΎ"))
('Ε‘aβ nak-ba-i-mu-ru iΕ‘-di-ma-a-ti ', 'Ε‘aβ-di-ba i mu ru-iΕ‘ di ma tukul-tu ', 'MUN kis BA Ε‘e-MU-Ε‘ub-Ε‘ah-αΉi-nab-nu-ti-')
```
This line was taken from the first line of the Epic of Gilgamesh: *Ε‘aβ naq-ba i-mu-ru iΕ‘-di ma-a-ti*; "He who saw the Deep, the foundation of the country" (George, A.R. 2003. *The Babylonian Gilgamesh Epic: Introduction, Critical Edition and Cuneiform Texts*. 2 vols. Oxford: Oxford University Press). Although the algorithms were not trained on this text genre, they show promising, useful results.
## Github
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
### Prerequisites
You will need a Python 3.7.x installed. Our package currently does not work with other versions of python. Go to [python's downloads page](<https://www.python.org/downloads/>) and pick an appropriate version.
If you don't have git installed, install git [here](<https://git-scm.com/downloads>) (Choose the appropriate operating system).
If you don't have a Github user, create one [here](<https://github.com/join?source=header-home>).
### Installing the python dependencies
In order to run the code, you will need the torch and allennlp libraries. If you have already installed the package akkadian, these were installed on your computer and you can skip to the next step.
Install torch: For Windows, copy the following to Command Prompt
```
pip install torch===1.3.1 torchvision===0.4.2 -f https://download.pytorch.org/whl/torch_stable.html
```
for Mac and Linux, copy the following to Terminal
```
pip install torch torchvision
```
Install allennlp: copy the following to Command Prompt (with windows) or Terminal (with mac):
```
pip install allennlp==0.8.5
```
### Cloning the project
Copy the following into Command Prompt (with windows) or Terminal (with mac) to clone the project:
```
git clone https://github.com/gaigutherz/Akkademia.git
```
### Running
Now you can develop the Akkademia repository and add your improvements!
#### Training
Use the file train.py in order to train the models using the datasets. There is a function for each model that trains, stores the pickle and tests its performance on a specific corpora.
The functions are as follows:
```
hmm_train_and_test(corpora)
memm_train_and_test(corpora)
biLSTM_train_and_test(corpora)
```
#### Transliterating
Use the file transliterate.py in order to transliterate using the models. There is a function for each model that takes Unicode cuneiform signs as parameter and returns its transliteration.
Example of usage:
```
cuneiform_signs = "π»π
ππΏπ¬ππ
π²π ππΎ"
print(transliterate(cuneiform_signs))
print(transliterate_bilstm(cuneiform_signs))
print(transliterate_bilstm_top3(cuneiform_signs))
print(transliterate_hmm(cuneiform_signs))
print(transliterate_memm(cuneiform_signs))
```
## Datasets
For training the algorithms, we used the RINAP corpora (Royal Inscriptions of the Neo-Assyrian Period), which are available in JSON and XML/TEI formats thanks to the efforts of the Humboldt Foundation-funded Official Inscriptions of the Middle East in Antiquity (OIMEA) Munich Project led by Karen Radner and Jamie Novotny, available [here](<http://oracc.org/rinap/>). The current output in our website, package and code is based on training done on these corpora alone.
For additional future training, we added the following corpora (in JSON file format) to the repository:
* **RIAO** - [Royal Inscriptions of Assyria online](<http://oracc.museum.upenn.edu/riao/>)
* **RIBO** - [Royal Inscriptions of Babylonia online](<http://oracc.museum.upenn.edu/ribo/>)
* **SAAO** - [State Archives of Assyria online](<http://oracc.museum.upenn.edu/saao/>)
* **SUHU** - [The Inscriptions of Suhu online Project](<http://oracc.museum.upenn.edu/suhu/>)
These corpora were all prepared by the Munich Open-access Cuneiform Corpus Initiative (MOCCI) and OIMEA project teams, both led by Karen Radner and Jamie Novotny, and are fully accessible for download in JSON or XML/TEI format in their respective project webpages (see left side-panel on project webpages and look for project-name downloads).
We also included a separate dataset which includes all the corpora in XML/TEI format.
### Datasets deployment
All the dataset are taken from their respective project webpages (see left side-panel on project webpages and look for project_name downloads) and are fully accessible from there.
In our repository the datasets are located in the "raw_data" directory. They can also be downloaded from the Github repository using git clone or zip download.
## Project structure
**BiLSTM_input**:
Contains dictionaries used for transliteration by BiLSTM.
**NMT_input**:
Contains dictionaries used for natural machine translation.
**akkadian.egg-info**:
Information and settings for akkadian python package.
**akkadian**:
Sources and train's output.
output: Train's output for HMM, MEMM and BiLSTM - mostly pickles.
__init__.py: Init script for akkadian python package. Initializes global variables.
bilstm.py: Class for BiLSTM train and prediction using AllenNLP implementation.
build_data.py: Code for organizing the data in dictionaries.
check_translation.py: Code for translation accuracy checking.
combine_algorithms.py: Code for prediction using both HMM, MEMM and BiLSTM.
data.py: Utils for accuracy checks and dictionaries interpretations.
full_translation_build_data.py: Code for organizing the data for full translation task.
get_texts_details.py: Util for getting more information about the text.
hmm.py: Implementation of HMM for train and prediction.
memm.py: Implementation of MEMM for train and prediction.
parse_json: Json parsing used for data organizing.
parse_xml.py: XML parsing used for data organizing.
train.py: API for training all 3 algorithms and store the output.
translation_tokenize.py: Code for tokenization of translation task.
transliterate.py: API for transliterating using all 3 algorithms.
**build/lib/akkadian**:
Information and settings for akkadian python package.
**dist**:
Akkadian python package - wheel and tar.
**raw_data**:
Databases used for training the models:
RINAP 1, 3-5
Additional databases for future training:
RIAO
RIBO
SAAO
SUHU
Miscellanea:
tei - the same databases (RINAP, RIAO, RIBO, SAAO, SUHU) in XML/TEI format.
random - 4 texts used for testing texts outside of the training corpora. They were randomly selected from RIAO and RIBO.
# Licensing
This repository is made freely available under the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license. This means you are free to share and adapt the code and datasets, under the conditions that you cite the project appropriately, note any changes you have made to the original code and datasets, and if you are redistributing the project or a part thereof, you must release it under the same license or a similar one.
For more information about the license, see [here](<https://creativecommons.org/licenses/by-sa/3.0/>).
# Issues and Bugs
If you are experiencing any issues with the website, the python package akkadian or the git repository, please contact us at dhl.arieluni@gmail.com, and we would gladly assist you. We would also much appreciate feedback about using the code via the website or the python package, or about the repository itself, so please send us any comments or suggestions.
### Authors
* Gai Gutherz
* Ariel Elazary
* Avital Romach
* Shai Gordin
%package -n python3-akkadian
Summary: Translating Akkadian signs to transliteration using NLP algorithms
Provides: python-akkadian
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-akkadian
# Akkademia
Akkademia is a tool for automatically transliterating Unicode cuneiform glyphs. It is written in python script and uses HMM, MEMM and BiLSTM neural networks to determine appropriate sign-readings and segmentation.
We trained these algorithms on the RINAP corpora (Royal Inscriptions of the Neo-Assyrian Period), which are available in JSON and XML/TEI formats thanks to the efforts of the Official Inscriptions of the Middle East in Antiquity (OIMEA) Munich Project of Karen Radner and Jamie Novotny, funded by the Alexander von Humboldt Foundation, available [here](<http://oracc.org/rinap/>). We achieve accuracy rates of 89.5% with HMM, 94% with MEMM, and 96.7% with BiLSTM on the trained corpora. Our model can also be used on texts from other periods and genres, with varying levels of success.
## Getting Started
Akkademia can be accessed in three different ways:
* Website
* Python package
* Github clone
The website and python package are meant to be accessible to people without advanced programming knowledge.
## Website
Go to the [Babylonian Engine website](<https://babylonian.herokuapp.com/>) (*under development*)
Go to the "Akkademia" tab and follow the instructions there for transliterating your signs.
## Python Package
Our python package "akkadian" will enable you to use Akkademia on your local machine.
### Prerequisites
You will need a Python 3.7.x installed. Our package currently does not work with other versions of python. You can follow the installation instructions [here](<https://realpython.com/installing-python/>) or go straight ahead to [python's downloads page](<https://www.python.org/downloads/>) and pick an appropriate version.
Mac comes preinstalled with python 2.7, which may remain the default python version even after installing 3.7.x. To check, type ``python --version`` into terminal. If the running version is python 2.7, the simplest short-term solution is to type ``python3`` or ``pip3`` in Terminal throughout instead of ``python`` and ``pip`` as in the instructions below.
### Package Installation
You can install the package using the pip install function. If you do not have pip installed on your computer, or you are not sure whether it is installed or not, you can follow the instructions [here](<https://www.makeuseof.com/tag/install-pip-for-python/>)
Before installing the package akkadian, you will need to install the torch package. For Windows, copy the following into Command Prompt (CMD):
```
pip install torch==1.0.0 torchvision==0.2.1 -f https://download.pytorch.org/whl/torch_stable.html
```
For Mac and Linux copy the following into Terminal:
```
pip install torch torchvision
```
Then, type the following in Command Prompt (Windows), or Terminal (Mac and Linux):
```
pip install akkadian
```
your installation should be executed. This will take several minutes.
### Running
Open a python IDE (Integrated development environment) where a python code can be run. There are many possible IDEs, see [realpython's guide](<https://realpython.com/python-ides-code-editors-guide/>) or [wiki python's list](<https://wiki.python.org/moin/IntegratedDevelopmentEnvironments>). For beginners, we recommend using Jupyter Notebook: see downloading instructions [here](<https://jupyter.org/install>), or see downloading instructions and beginners' tutorial [here](<https://realpython.com/jupyter-notebook-introduction/>).
First, import ```akkadian.transliterate``` into your coding environment:
```
import akkadian.transliterate as akk
```
Then, you can use HMM, MEMM, or BiLSTM to transliterate the signs. The functions are:
```
akk.transliterate_hmm("Unicode_signs_here")
akk.transliterate_memm("Unicode_signs_here")
akk.transliterate_bilstm("Unicode_signs_here")
akk.transliterate_bilstm_top3("Unicode_signs_here")
```
```akk.transliterate_bilstm_top3``` gives the top three BiLSTM options, while ```akk.transliterate_bilstm``` gives only the top one.
For an immediate output of the results, put the ```akk.transliterate()``` function inside the ```print()``` function. Here are some examples with their output:
```
print(akk.transliterate_hmm("π»π
ππΏπ¬ππ
π²π ππΎ"))
Ε‘aβ nak-ba-i-mu-ru iΕ‘-di-ma-a-ti
```
```
print(akk.transliterate_memm("π»π
ππΏπ¬ππ
π²π ππΎ"))
Ε‘aβ SILIM ba-i-mu-ru-iΕ‘-di-ma-a-ti
```
```
print(akk.transliterate_bilstm("π»π
ππΏπ¬ππ
π²π ππΎ"))
Ε‘aβ nak-ba-i-mu-ru iΕ‘-di-ma-a-ti
```
```
print(akk.transliterate_bilstm_top3("π»π
ππΏπ¬ππ
π²π ππΎ"))
('Ε‘aβ nak-ba-i-mu-ru iΕ‘-di-ma-a-ti ', 'Ε‘aβ-di-ba i mu ru-iΕ‘ di ma tukul-tu ', 'MUN kis BA Ε‘e-MU-Ε‘ub-Ε‘ah-αΉi-nab-nu-ti-')
```
This line was taken from the first line of the Epic of Gilgamesh: *Ε‘aβ naq-ba i-mu-ru iΕ‘-di ma-a-ti*; "He who saw the Deep, the foundation of the country" (George, A.R. 2003. *The Babylonian Gilgamesh Epic: Introduction, Critical Edition and Cuneiform Texts*. 2 vols. Oxford: Oxford University Press). Although the algorithms were not trained on this text genre, they show promising, useful results.
## Github
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
### Prerequisites
You will need a Python 3.7.x installed. Our package currently does not work with other versions of python. Go to [python's downloads page](<https://www.python.org/downloads/>) and pick an appropriate version.
If you don't have git installed, install git [here](<https://git-scm.com/downloads>) (Choose the appropriate operating system).
If you don't have a Github user, create one [here](<https://github.com/join?source=header-home>).
### Installing the python dependencies
In order to run the code, you will need the torch and allennlp libraries. If you have already installed the package akkadian, these were installed on your computer and you can skip to the next step.
Install torch: For Windows, copy the following to Command Prompt
```
pip install torch===1.3.1 torchvision===0.4.2 -f https://download.pytorch.org/whl/torch_stable.html
```
for Mac and Linux, copy the following to Terminal
```
pip install torch torchvision
```
Install allennlp: copy the following to Command Prompt (with windows) or Terminal (with mac):
```
pip install allennlp==0.8.5
```
### Cloning the project
Copy the following into Command Prompt (with windows) or Terminal (with mac) to clone the project:
```
git clone https://github.com/gaigutherz/Akkademia.git
```
### Running
Now you can develop the Akkademia repository and add your improvements!
#### Training
Use the file train.py in order to train the models using the datasets. There is a function for each model that trains, stores the pickle and tests its performance on a specific corpora.
The functions are as follows:
```
hmm_train_and_test(corpora)
memm_train_and_test(corpora)
biLSTM_train_and_test(corpora)
```
#### Transliterating
Use the file transliterate.py in order to transliterate using the models. There is a function for each model that takes Unicode cuneiform signs as parameter and returns its transliteration.
Example of usage:
```
cuneiform_signs = "π»π
ππΏπ¬ππ
π²π ππΎ"
print(transliterate(cuneiform_signs))
print(transliterate_bilstm(cuneiform_signs))
print(transliterate_bilstm_top3(cuneiform_signs))
print(transliterate_hmm(cuneiform_signs))
print(transliterate_memm(cuneiform_signs))
```
## Datasets
For training the algorithms, we used the RINAP corpora (Royal Inscriptions of the Neo-Assyrian Period), which are available in JSON and XML/TEI formats thanks to the efforts of the Humboldt Foundation-funded Official Inscriptions of the Middle East in Antiquity (OIMEA) Munich Project led by Karen Radner and Jamie Novotny, available [here](<http://oracc.org/rinap/>). The current output in our website, package and code is based on training done on these corpora alone.
For additional future training, we added the following corpora (in JSON file format) to the repository:
* **RIAO** - [Royal Inscriptions of Assyria online](<http://oracc.museum.upenn.edu/riao/>)
* **RIBO** - [Royal Inscriptions of Babylonia online](<http://oracc.museum.upenn.edu/ribo/>)
* **SAAO** - [State Archives of Assyria online](<http://oracc.museum.upenn.edu/saao/>)
* **SUHU** - [The Inscriptions of Suhu online Project](<http://oracc.museum.upenn.edu/suhu/>)
These corpora were all prepared by the Munich Open-access Cuneiform Corpus Initiative (MOCCI) and OIMEA project teams, both led by Karen Radner and Jamie Novotny, and are fully accessible for download in JSON or XML/TEI format in their respective project webpages (see left side-panel on project webpages and look for project-name downloads).
We also included a separate dataset which includes all the corpora in XML/TEI format.
### Datasets deployment
All the dataset are taken from their respective project webpages (see left side-panel on project webpages and look for project_name downloads) and are fully accessible from there.
In our repository the datasets are located in the "raw_data" directory. They can also be downloaded from the Github repository using git clone or zip download.
## Project structure
**BiLSTM_input**:
Contains dictionaries used for transliteration by BiLSTM.
**NMT_input**:
Contains dictionaries used for natural machine translation.
**akkadian.egg-info**:
Information and settings for akkadian python package.
**akkadian**:
Sources and train's output.
output: Train's output for HMM, MEMM and BiLSTM - mostly pickles.
__init__.py: Init script for akkadian python package. Initializes global variables.
bilstm.py: Class for BiLSTM train and prediction using AllenNLP implementation.
build_data.py: Code for organizing the data in dictionaries.
check_translation.py: Code for translation accuracy checking.
combine_algorithms.py: Code for prediction using both HMM, MEMM and BiLSTM.
data.py: Utils for accuracy checks and dictionaries interpretations.
full_translation_build_data.py: Code for organizing the data for full translation task.
get_texts_details.py: Util for getting more information about the text.
hmm.py: Implementation of HMM for train and prediction.
memm.py: Implementation of MEMM for train and prediction.
parse_json: Json parsing used for data organizing.
parse_xml.py: XML parsing used for data organizing.
train.py: API for training all 3 algorithms and store the output.
translation_tokenize.py: Code for tokenization of translation task.
transliterate.py: API for transliterating using all 3 algorithms.
**build/lib/akkadian**:
Information and settings for akkadian python package.
**dist**:
Akkadian python package - wheel and tar.
**raw_data**:
Databases used for training the models:
RINAP 1, 3-5
Additional databases for future training:
RIAO
RIBO
SAAO
SUHU
Miscellanea:
tei - the same databases (RINAP, RIAO, RIBO, SAAO, SUHU) in XML/TEI format.
random - 4 texts used for testing texts outside of the training corpora. They were randomly selected from RIAO and RIBO.
# Licensing
This repository is made freely available under the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license. This means you are free to share and adapt the code and datasets, under the conditions that you cite the project appropriately, note any changes you have made to the original code and datasets, and if you are redistributing the project or a part thereof, you must release it under the same license or a similar one.
For more information about the license, see [here](<https://creativecommons.org/licenses/by-sa/3.0/>).
# Issues and Bugs
If you are experiencing any issues with the website, the python package akkadian or the git repository, please contact us at dhl.arieluni@gmail.com, and we would gladly assist you. We would also much appreciate feedback about using the code via the website or the python package, or about the repository itself, so please send us any comments or suggestions.
### Authors
* Gai Gutherz
* Ariel Elazary
* Avital Romach
* Shai Gordin
%package help
Summary: Development documents and examples for akkadian
Provides: python3-akkadian-doc
%description help
# Akkademia
Akkademia is a tool for automatically transliterating Unicode cuneiform glyphs. It is written in python script and uses HMM, MEMM and BiLSTM neural networks to determine appropriate sign-readings and segmentation.
We trained these algorithms on the RINAP corpora (Royal Inscriptions of the Neo-Assyrian Period), which are available in JSON and XML/TEI formats thanks to the efforts of the Official Inscriptions of the Middle East in Antiquity (OIMEA) Munich Project of Karen Radner and Jamie Novotny, funded by the Alexander von Humboldt Foundation, available [here](<http://oracc.org/rinap/>). We achieve accuracy rates of 89.5% with HMM, 94% with MEMM, and 96.7% with BiLSTM on the trained corpora. Our model can also be used on texts from other periods and genres, with varying levels of success.
## Getting Started
Akkademia can be accessed in three different ways:
* Website
* Python package
* Github clone
The website and python package are meant to be accessible to people without advanced programming knowledge.
## Website
Go to the [Babylonian Engine website](<https://babylonian.herokuapp.com/>) (*under development*)
Go to the "Akkademia" tab and follow the instructions there for transliterating your signs.
## Python Package
Our python package "akkadian" will enable you to use Akkademia on your local machine.
### Prerequisites
You will need a Python 3.7.x installed. Our package currently does not work with other versions of python. You can follow the installation instructions [here](<https://realpython.com/installing-python/>) or go straight ahead to [python's downloads page](<https://www.python.org/downloads/>) and pick an appropriate version.
Mac comes preinstalled with python 2.7, which may remain the default python version even after installing 3.7.x. To check, type ``python --version`` into terminal. If the running version is python 2.7, the simplest short-term solution is to type ``python3`` or ``pip3`` in Terminal throughout instead of ``python`` and ``pip`` as in the instructions below.
### Package Installation
You can install the package using the pip install function. If you do not have pip installed on your computer, or you are not sure whether it is installed or not, you can follow the instructions [here](<https://www.makeuseof.com/tag/install-pip-for-python/>)
Before installing the package akkadian, you will need to install the torch package. For Windows, copy the following into Command Prompt (CMD):
```
pip install torch==1.0.0 torchvision==0.2.1 -f https://download.pytorch.org/whl/torch_stable.html
```
For Mac and Linux copy the following into Terminal:
```
pip install torch torchvision
```
Then, type the following in Command Prompt (Windows), or Terminal (Mac and Linux):
```
pip install akkadian
```
your installation should be executed. This will take several minutes.
### Running
Open a python IDE (Integrated development environment) where a python code can be run. There are many possible IDEs, see [realpython's guide](<https://realpython.com/python-ides-code-editors-guide/>) or [wiki python's list](<https://wiki.python.org/moin/IntegratedDevelopmentEnvironments>). For beginners, we recommend using Jupyter Notebook: see downloading instructions [here](<https://jupyter.org/install>), or see downloading instructions and beginners' tutorial [here](<https://realpython.com/jupyter-notebook-introduction/>).
First, import ```akkadian.transliterate``` into your coding environment:
```
import akkadian.transliterate as akk
```
Then, you can use HMM, MEMM, or BiLSTM to transliterate the signs. The functions are:
```
akk.transliterate_hmm("Unicode_signs_here")
akk.transliterate_memm("Unicode_signs_here")
akk.transliterate_bilstm("Unicode_signs_here")
akk.transliterate_bilstm_top3("Unicode_signs_here")
```
```akk.transliterate_bilstm_top3``` gives the top three BiLSTM options, while ```akk.transliterate_bilstm``` gives only the top one.
For an immediate output of the results, put the ```akk.transliterate()``` function inside the ```print()``` function. Here are some examples with their output:
```
print(akk.transliterate_hmm("π»π
ππΏπ¬ππ
π²π ππΎ"))
Ε‘aβ nak-ba-i-mu-ru iΕ‘-di-ma-a-ti
```
```
print(akk.transliterate_memm("π»π
ππΏπ¬ππ
π²π ππΎ"))
Ε‘aβ SILIM ba-i-mu-ru-iΕ‘-di-ma-a-ti
```
```
print(akk.transliterate_bilstm("π»π
ππΏπ¬ππ
π²π ππΎ"))
Ε‘aβ nak-ba-i-mu-ru iΕ‘-di-ma-a-ti
```
```
print(akk.transliterate_bilstm_top3("π»π
ππΏπ¬ππ
π²π ππΎ"))
('Ε‘aβ nak-ba-i-mu-ru iΕ‘-di-ma-a-ti ', 'Ε‘aβ-di-ba i mu ru-iΕ‘ di ma tukul-tu ', 'MUN kis BA Ε‘e-MU-Ε‘ub-Ε‘ah-αΉi-nab-nu-ti-')
```
This line was taken from the first line of the Epic of Gilgamesh: *Ε‘aβ naq-ba i-mu-ru iΕ‘-di ma-a-ti*; "He who saw the Deep, the foundation of the country" (George, A.R. 2003. *The Babylonian Gilgamesh Epic: Introduction, Critical Edition and Cuneiform Texts*. 2 vols. Oxford: Oxford University Press). Although the algorithms were not trained on this text genre, they show promising, useful results.
## Github
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
### Prerequisites
You will need a Python 3.7.x installed. Our package currently does not work with other versions of python. Go to [python's downloads page](<https://www.python.org/downloads/>) and pick an appropriate version.
If you don't have git installed, install git [here](<https://git-scm.com/downloads>) (Choose the appropriate operating system).
If you don't have a Github user, create one [here](<https://github.com/join?source=header-home>).
### Installing the python dependencies
In order to run the code, you will need the torch and allennlp libraries. If you have already installed the package akkadian, these were installed on your computer and you can skip to the next step.
Install torch: For Windows, copy the following to Command Prompt
```
pip install torch===1.3.1 torchvision===0.4.2 -f https://download.pytorch.org/whl/torch_stable.html
```
for Mac and Linux, copy the following to Terminal
```
pip install torch torchvision
```
Install allennlp: copy the following to Command Prompt (with windows) or Terminal (with mac):
```
pip install allennlp==0.8.5
```
### Cloning the project
Copy the following into Command Prompt (with windows) or Terminal (with mac) to clone the project:
```
git clone https://github.com/gaigutherz/Akkademia.git
```
### Running
Now you can develop the Akkademia repository and add your improvements!
#### Training
Use the file train.py in order to train the models using the datasets. There is a function for each model that trains, stores the pickle and tests its performance on a specific corpora.
The functions are as follows:
```
hmm_train_and_test(corpora)
memm_train_and_test(corpora)
biLSTM_train_and_test(corpora)
```
#### Transliterating
Use the file transliterate.py in order to transliterate using the models. There is a function for each model that takes Unicode cuneiform signs as parameter and returns its transliteration.
Example of usage:
```
cuneiform_signs = "π»π
ππΏπ¬ππ
π²π ππΎ"
print(transliterate(cuneiform_signs))
print(transliterate_bilstm(cuneiform_signs))
print(transliterate_bilstm_top3(cuneiform_signs))
print(transliterate_hmm(cuneiform_signs))
print(transliterate_memm(cuneiform_signs))
```
## Datasets
For training the algorithms, we used the RINAP corpora (Royal Inscriptions of the Neo-Assyrian Period), which are available in JSON and XML/TEI formats thanks to the efforts of the Humboldt Foundation-funded Official Inscriptions of the Middle East in Antiquity (OIMEA) Munich Project led by Karen Radner and Jamie Novotny, available [here](<http://oracc.org/rinap/>). The current output in our website, package and code is based on training done on these corpora alone.
For additional future training, we added the following corpora (in JSON file format) to the repository:
* **RIAO** - [Royal Inscriptions of Assyria online](<http://oracc.museum.upenn.edu/riao/>)
* **RIBO** - [Royal Inscriptions of Babylonia online](<http://oracc.museum.upenn.edu/ribo/>)
* **SAAO** - [State Archives of Assyria online](<http://oracc.museum.upenn.edu/saao/>)
* **SUHU** - [The Inscriptions of Suhu online Project](<http://oracc.museum.upenn.edu/suhu/>)
These corpora were all prepared by the Munich Open-access Cuneiform Corpus Initiative (MOCCI) and OIMEA project teams, both led by Karen Radner and Jamie Novotny, and are fully accessible for download in JSON or XML/TEI format in their respective project webpages (see left side-panel on project webpages and look for project-name downloads).
We also included a separate dataset which includes all the corpora in XML/TEI format.
### Datasets deployment
All the dataset are taken from their respective project webpages (see left side-panel on project webpages and look for project_name downloads) and are fully accessible from there.
In our repository the datasets are located in the "raw_data" directory. They can also be downloaded from the Github repository using git clone or zip download.
## Project structure
**BiLSTM_input**:
Contains dictionaries used for transliteration by BiLSTM.
**NMT_input**:
Contains dictionaries used for natural machine translation.
**akkadian.egg-info**:
Information and settings for akkadian python package.
**akkadian**:
Sources and train's output.
output: Train's output for HMM, MEMM and BiLSTM - mostly pickles.
__init__.py: Init script for akkadian python package. Initializes global variables.
bilstm.py: Class for BiLSTM train and prediction using AllenNLP implementation.
build_data.py: Code for organizing the data in dictionaries.
check_translation.py: Code for translation accuracy checking.
combine_algorithms.py: Code for prediction using both HMM, MEMM and BiLSTM.
data.py: Utils for accuracy checks and dictionaries interpretations.
full_translation_build_data.py: Code for organizing the data for full translation task.
get_texts_details.py: Util for getting more information about the text.
hmm.py: Implementation of HMM for train and prediction.
memm.py: Implementation of MEMM for train and prediction.
parse_json: Json parsing used for data organizing.
parse_xml.py: XML parsing used for data organizing.
train.py: API for training all 3 algorithms and store the output.
translation_tokenize.py: Code for tokenization of translation task.
transliterate.py: API for transliterating using all 3 algorithms.
**build/lib/akkadian**:
Information and settings for akkadian python package.
**dist**:
Akkadian python package - wheel and tar.
**raw_data**:
Databases used for training the models:
RINAP 1, 3-5
Additional databases for future training:
RIAO
RIBO
SAAO
SUHU
Miscellanea:
tei - the same databases (RINAP, RIAO, RIBO, SAAO, SUHU) in XML/TEI format.
random - 4 texts used for testing texts outside of the training corpora. They were randomly selected from RIAO and RIBO.
# Licensing
This repository is made freely available under the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license. This means you are free to share and adapt the code and datasets, under the conditions that you cite the project appropriately, note any changes you have made to the original code and datasets, and if you are redistributing the project or a part thereof, you must release it under the same license or a similar one.
For more information about the license, see [here](<https://creativecommons.org/licenses/by-sa/3.0/>).
# Issues and Bugs
If you are experiencing any issues with the website, the python package akkadian or the git repository, please contact us at dhl.arieluni@gmail.com, and we would gladly assist you. We would also much appreciate feedback about using the code via the website or the python package, or about the repository itself, so please send us any comments or suggestions.
### Authors
* Gai Gutherz
* Ariel Elazary
* Avital Romach
* Shai Gordin
%prep
%autosetup -n akkadian-1.0.12
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-akkadian -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.12-1
- Package Spec generated
|