User:Benwbrum/Cuneiform Perl Scripts/Akkadian Consonant Script

#!/usr/bin/perl

while(<>) {
  chomp;
  $line = $_;

  # handle emphatic s BEFORE shins
  $line =~ s/([a-z])S/$1\ṣ/g;
  $line =~ s/S([a-z])/\ṣ$1/g;

  # handle shins
  $line =~ s/([A-Z])\$/$1\Š/g;
  $line =~ s/([a-z])\$/$1\š/g;
  $line =~ s/\$([A-Z])/\Š$1/g;
  $line =~ s/\$([a-z])/\š$1/g;

  # handle emphatic t
  $line =~ s/([a-z])T/$1\ḍ/g;
  $line =~ s/T([a-z])/\ḍ$1/g;

  # handle h
  $line =~ s/h/\ḫ/g;

  print("$line\n");
}

transforms

7. $um-ma a-wi-lum lu kaspam lu hurâSam lu wardam lu amtam lu alpam lu immeram11 lu imêram12 u3 lu mi-im-ma $um-$u2 i-na ga-at mâr13 a-wi-lum14 u3 lu warad15 a-wi-lim ba-lum $i-bi u3 ri-ik-sa-tim i$-ta-am u3 lu a-na ma-Sa-ru-tim im-hu-ur a-wi-lum $u2-u2 $ar-ra-aq id-da-ak

8. $um-ma a-wi-lum lu alpam lu immeram11 lu imêram lu $ahâm 12 u3 lu GI$.MÁ16 i$-ri-iq $um-ma $a2 i-lim $um-ma $a2 êkallim17 a-du18 XXX-$u2 i-na-ad-di-in $um-ma #a2 MA$.EN.KAK19 a-du20 X-$u2 i-ri-a-ab $um-ma $ar-ra-ga-nu-um $a2 na-da-nim la i-$u2 id-da-ak

into

7. šum-ma a-wi-lum lu kaspam lu ḫurâṣam lu wardam lu amtam lu alpam lu immeram11 lu imêram12 u3 lu mi-im-ma šum-šu2 i-na ga-at mâr13 a-wi-lum14 u3 lu warad15 a-wi-lim ba-lum ši-bi u3 ri-ik-sa-tim iš-ta-am u3 lu a-na ma-ṣa-ru-tim im-ḫu-ur a-wi-lum šu2-u2 šar-ra-aq id-da-ak

8. šum-ma a-wi-lum lu alpam lu immeram11 lu imêram lu šaḫâm 12 u3 lu GIŠ.MÁ16 iš-ri-iq šum-ma ša2 i-lim šum-ma ša2 êkallim17 a-du18 XXX-šu2 i-na-ad-di-in šum-ma #a2 MAŠ.EN.KAK19 a-du20 X-šu2 i-ri-a-ab šum-ma šar-ra-ga-nu-um ša2 na-da-nim la i-šu2 id-da-ak