Looking for some translators Latin or Greek

  • Thread starter Thread starter COPLAND_3
  • Start date Start date
Status
Not open for further replies.
I am just using sed – stream editor. The standard command line utility for unix – it shows up on all flavors Sun, Linux, Caldera, etc. Some versions of sed can’t do escape sequences such as "
" for newline, etc – but you mentioned Linux and that has Gnu-sed which is bullet-proof.

Here it is wrapped in a shell script, chmod +x sedscript to make it executable.
Code:
#!/bin/bash
cat $1 | sed -e "y%abcdefghijklmnopqrstu!wxyz%αβχδεφγηιςκλμνοπθρστυ!ωξ!ζ%" -e "y%ABCDEFGHIJKLMNOPQRSTU!WXYZ%ΑΒΧΔΕΦΓΗΙΣΚΛΜΝΟΠΘΡΣΤΥ!ΩΞ!Ζ%" -e "s%\]%.%g" -e "s%/|%|/%g" -e "s%V%\xca\xbc%g" -e "s%v%\xcc\x93%g"  -e "s%,%\xcc\x81%g" -e "s%\`%\xcc\x94%g" -e "s%-%\xcc\x83\xcc\x94%g" -e "s%=%\xcc\x83\xcc\x93%g" -e "s%.]%\xcc\x80%g" -e "s%/]%\xcd\x85%g" -e "s%|]%\xcc\x83%g" -e "s%]%\xcc\x81\xcc\x94%g" -e "s%]]%\xcc\x80\xcc\x94%g" -e "s%;%\xcc\x93\xcc\x80%g" -e "s%:space:]][0-9]%
&%g"   > $2
It looks like I might have a loose iota subscript being placed under the omegas – I am not sure what the diacritics are supposed to be anyway, as I strip them except for rough breathing and the large tilde for my purposes – so take a good look.
Yes, Normalization to the NFC form will fix the font issues…

Unfortunately, the easiest to do normalization on is Java.
There is a perl script, but something was out of date and it failed to load the conversion tables properly…

search.cpan.org/~sadahiro/Unicode-Normalize-1.03/Normalize.pm

I also came across a php version, but it is just the class library and it was too convoluted for me to figure out last night. You would have to write a driver program to call the class subroutines … and the straight forward load file, dump through normalizer, and dump output program I wrote puked on several directory dependencies… etc. So I gave up and went to bed…

If you want to do some digging and working on these programs, I would be happy to give you pointers about what I know. I know how these things work – I just am unable to concentrate sufficiently to bring all the pieces together. Medical issues…

–Andrew.
Thanks, you saved me a lot of time. I like sed and use it frequently. I will have no problem using it. I hope your health improves.

Best Regards,
Dan
 
I am just using sed – stream editor. The standard command line utility for unix – it shows up on all flavors Sun, Linux, Caldera, etc. Some versions of sed can’t do escape sequences such as "
" for newline, etc – but you mentioned Linux and that has Gnu-sed which is bullet-proof.

Here it is wrapped in a shell script, chmod +x sedscript to make it executable.
Code:
#!/bin/bash
cat $1 | sed -e "y%abcdefghijklmnopqrstu!wxyz%αβχδεφγηιςκλμνοπθρστυ!ωξ!ζ%" -e "y%ABCDEFGHIJKLMNOPQRSTU!WXYZ%ΑΒΧΔΕΦΓΗΙΣΚΛΜΝΟΠΘΡΣΤΥ!ΩΞ!Ζ%" -e "s%\]%.%g" -e "s%/|%|/%g" -e "s%V%\xca\xbc%g" -e "s%v%\xcc\x93%g"  -e "s%,%\xcc\x81%g" -e "s%\`%\xcc\x94%g" -e "s%-%\xcc\x83\xcc\x94%g" -e "s%=%\xcc\x83\xcc\x93%g" -e "s%.]%\xcc\x80%g" -e "s%/]%\xcd\x85%g" -e "s%|]%\xcc\x83%g" -e "s%]%\xcc\x81\xcc\x94%g" -e "s%]]%\xcc\x80\xcc\x94%g" -e "s%;%\xcc\x93\xcc\x80%g" -e "s%:space:]][0-9]%
&%g"   > $2
It looks like I might have a loose iota subscript being placed under the omegas – I am not sure what the diacritics are supposed to be anyway, as I strip them except for rough breathing and the large tilde for my purposes – so take a good look.
Yes, Normalization to the NFC form will fix the font issues…

Unfortunately, the easiest to do normalization on is Java.
There is a perl script, but something was out of date and it failed to load the conversion tables properly…

search.cpan.org/~sadahiro/Unicode-Normalize-1.03/Normalize.pm

I also came across a php version, but it is just the class library and it was too convoluted for me to figure out last night. You would have to write a driver program to call the class subroutines … and the straight forward load file, dump through normalizer, and dump output program I wrote puked on several directory dependencies… etc. So I gave up and went to bed…

If you want to do some digging and working on these programs, I would be happy to give you pointers about what I know. I know how these things work – I just am unable to concentrate sufficiently to bring all the pieces together. Medical issues…

–Andrew.
Should this work on a character based unix system? My sed runs fine but I have not been sucessful getting it to display. When I cut and paste into the editor it changes the script to the following.

#!/bin/bash
/bin/cat $1 | /bin/sed -e “y%abcdefghijklmnopqrstu!wxyz%…!..!.%” -e “y%ABCDEFGHIJKLMNOPQRSTU!WXYZ%…!..!.%” -e “s%]%.%g” -e “s%/|%|/%g” -e “s%V%\xca\xbc%g” -e “s%v%\xcc\x93%g” -e “s%,%\xcc\x81%g” -e “s%`%\xcc\x94%g” -e “s%-%\xcc\x83\xcc\x94%g” -e “s%=%\xcc\x83\xcc\x93%g” -e “s%.]%\xcc\x80%g” -e “s%/]%\xcd\x85%g” -e “s%|]%\xcc\x83%g” -e “s%]%\xcc\x81\xcc\x94%g” -e “s%]]%\xcc\x80\xcc\x94%g” -e “s%;%\xcc\x93\xcc\x80%g” -e “s%:space:]][0-9]%
&%g” > $2

Looks like this may only work on a gui system. I guess I could install one.
~
 
Should this work on a character based unix system? My sed runs fine but I have not been sucessful getting it to display. When I cut and paste into the editor it changes the script to the following.

#!/bin/bash
/bin/cat $1 | /bin/sed -e “y%abcdefghijklmnopqrstu!wxyz%…!..!.%” -e “y%ABCDEFGHIJKLMNOPQRSTU!WXYZ%…!..!.%” -e “s%]%.%g” -e “s%/|%|/%g” -e “s%V%\xca\xbc%g” -e “s%v%\xcc\x93%g” -e “s%,%\xcc\x81%g” -e “s%`%\xcc\x94%g” -e “s%-%\xcc\x83\xcc\x94%g” -e “s%=%\xcc\x83\xcc\x93%g” -e “s%.]%\xcc\x80%g” -e “s%/]%\xcd\x85%g” -e “s%|]%\xcc\x83%g” -e “s%]%\xcc\x81\xcc\x94%g” -e “s%]]%\xcc\x80\xcc\x94%g” -e “s%;%\xcc\x93\xcc\x80%g” -e “s%:space:]][0-9]%
&%g” > $2

Looks like this may only work on a gui system. I guess I could install one.
~
That’s extremely odd. When I kick down to raw terminal mode (exit X11), I can still run and execute the script just fine. When I pull it up in vim (not plain vi, but the improved version vim which is UTF-8 aware) The Greek characters are all garbeled into the high values of the ASCII charset (They don’t look right – but they ARE right). The solution to that problem is to kick into higher resolution terminal mode which (I forget the command) but there are utilities for that in Linux.
IF you go into say 128x40 character mode – what happens is that your computer’s built in bios emulates the text screen by using a VGA/SVGA/VESA mode on your graphics card.
The bonus here is that the individual letters are drawn from a bitmapped lookup table in memory – which Linux will let you overload with a different Font; EG a Greek one. Then you can use the iconv program to translate the unicode file from sed into that legacy font and everything will look right. On the other hand, it is no longer UTF-8 and that is kind of annoying because you will have to learn special key bindings to get your version of the Greek character to come up.

On the other hand, two things strike me as odd here – how are you seeing the greek characters on your web browser in the first place? When I use lynx or links from the text terminal they can’t display Greek properly and it looks like garbage.
Is your web browser running in graphics mode without X11 turned on – or is it on a different computer?

Secondly, see if you can cut and paste these greek characters from your web browser into a “reply” to topic in the same web browser. *You don’t have to submit it – just do the cut and paste. I have noted some web browsers (notably Opera) can’t do it right but others like Firefox can. If that’s the problem – you can PrivateMessage me an email adress so you don’t get spammed… and I can send you the sed script as a .zip attachement, so you can unzip it and then, regardless of what it looks like, it will have the correct characters to do the conversion.

Also, the shell(s) have different terminal emulation settings – and you may need to put your terminal into UTF-8 mode for certain programs to work right with unicode (I don’t know if this affects sed).

eg: If in a bash shell it would simply be “set LANG=en_US.UTF8”,
for csh, tcsh, ash, and Korn all have a way to set the environment variable as well – but it has been too long for me to remember off the top of my head;

If your system is not too slow, or super memory limited, installing a gui like X11 is the way to go. But if your web browser can view greek because it works in a VGA mode by itself, you might consider using that as a text viewer – though probably not an editor.
Just break the bible up into books and name them with .html ; then your web browser should be able to access them using this neat unix feature that most don’t know about: For the URL, just type in “File://path/to/bible/stuff/on/hard/drive/bookname.html” (of course this is a foobar example, change appropriately…)

If you do the X11 route and get stuck, let me know and I can give you a hand there too – I usually install it raw without a package helper because that’s how I learned to do it 15 years ago… but I have made every mistake possible, broken various pieces, libraries, etc. and I can point you to the appropriate things to check in order to trouble shoot…

Best wishes;
–Andrew.
 
That’s extremely odd. When I kick down to raw terminal mode (exit X11), I can still run and execute the script just fine. When I pull it up in vim (not plain vi, but the improved version vim which is UTF-8 aware) The Greek characters are all garbeled into the high values of the ASCII charset (They don’t look right – but they ARE right). The solution to that problem is to kick into higher resolution terminal mode which (I forget the command) but there are utilities for that in Linux.
IF you go into say 128x40 character mode – what happens is that your computer’s built in bios emulates the text screen by using a VGA/SVGA/VESA mode on your graphics card.
The bonus here is that the individual letters are drawn from a bitmapped lookup table in memory – which Linux will let you overload with a different Font; EG a Greek one. Then you can use the iconv program to translate the unicode file from sed into that legacy font and everything will look right. On the other hand, it is no longer UTF-8 and that is kind of annoying because you will have to learn special key bindings to get your version of the Greek character to come up.

On the other hand, two things strike me as odd here – how are you seeing the greek characters on your web browser in the first place? When I use lynx or links from the text terminal they can’t display Greek properly and it looks like garbage.
Is your web browser running in graphics mode without X11 turned on – or is it on a different computer?

Secondly, see if you can cut and paste these greek characters from your web browser into a “reply” to topic in the same web browser. *You don’t have to submit it – just do the cut and paste. I have noted some web browsers (notably Opera) can’t do it right but others like Firefox can. If that’s the problem – you can PrivateMessage me an email adress so you don’t get spammed… and I can send you the sed script as a .zip attachement, so you can unzip it and then, regardless of what it looks like, it will have the correct characters to do the conversion.

Also, the shell(s) have different terminal emulation settings – and you may need to put your terminal into UTF-8 mode for certain programs to work right with unicode (I don’t know if this affects sed).

eg: If in a bash shell it would simply be “set LANG=en_US.UTF8”,
for csh, tcsh, ash, and Korn all have a way to set the environment variable as well – but it has been too long for me to remember off the top of my head;

If your system is not too slow, or super memory limited, installing a gui like X11 is the way to go. But if your web browser can view greek because it works in a VGA mode by itself, you might consider using that as a text viewer – though probably not an editor.
Just break the bible up into books and name them with .html ; then your web browser should be able to access them using this neat unix feature that most don’t know about: For the URL, just type in “File://path/to/bible/stuff/on/hard/drive/bookname.html” (of course this is a foobar example, change appropriately…)

If you do the X11 route and get stuck, let me know and I can give you a hand there too – I usually install it raw without a package helper because that’s how I learned to do it 15 years ago… but I have made every mistake possible, broken various pieces, libraries, etc. and I can point you to the appropriate things to check in order to trouble shoot…

Best wishes;
–Andrew.
Here is how I am currently using linux. I ssh into a unix box (or sometimes cygwin in Windows) and execute scripts to process my files. The output is usually xml or html. Then I take those files and view them in a web browser on any platform I choose. I do this because I like unix utilities and hate windows 🙂
 
Here is how I am currently using linux. I ssh into a unix box (or sometimes cygwin in Windows) and execute scripts to process my files. The output is usually xml or html. Then I take those files and view them in a web browser on any platform I choose. I do this because I like unix utilities and hate windows 🙂
Ok, I get it. So, if you want the sed script zipped – just drop me the e-mail, and happy batch processing to you…

–Andrew.
 
Ok, I get it. So, if you want the sed script zipped – just drop me the e-mail, and happy batch processing to you…

–Andrew.
Are you saying that if the script file is zipped and then unzipped on the file system of the character based unix system that it will run properly?
 
Are you saying that if the script file is zipped and then unzipped on the file system of the character based unix system that it will run properly?
YES. It would have just been easier to send me an email and try it – but if I am going to bother to reply again… here’s a non-zip fix (courtesty of my Brother who was kind enough to help me as I couldn’t hit the side of a barn right now if I tried…)
All unicode chars are replaced with hex escape sequences.
Code:
#!/bin/bash
cat $1 | sed -e "y%abcdefghijklmnopqrstu!wxyz%\xce\xb1\xce\xb2\xcf\x87\xce\xb4\xce\xb5\xcf\x86\xce\xb3\xce\xb7\xce\xb9\xcf\x82\xce\xba\xce\xbb\xce\xbc\xce\xbd\xce\xbf\xcf\x80\xce\xb8\xcf\x81\xcf\x83\xcf\x84\xcf\x85\x21\xcf\x89\xce\xbe\x21\xce\xb6%" -e "y%ABCDEFGHIJKLMNOPQRSTU!WXYZ%\xce\x91\xce\x92\xce\xa7\xce\x94\xce\x95\xce\xa6\xce\x93\xce\x97\xce\x99\xce\xa3\xce\x9a\xce\x9b\xce\x9c\xce\x9d\xce\x9f\xce\xa0\xce\x98\xce\xa1\xce\xa3\xce\xa4\xce\xa5\x21\xce\xa9\xce\x9e\x21\xce\x96%" -e "s%\]%.%g" -e "s%/|%|/%g" -e "s%V%\xca\xbc%g" -e "s%v%\xcc\x93%g"  -e "s%,%\xcc\x81%g" -e "s%\`%\xcc\x94%g" -e "s%-%\xcc\x83\xcc\x94%g" -e "s%=%\xcc\x83\xcc\x93%g" -e "s%.]%\xcc\x80%g" -e "s%/]%\xcd\x85%g" -e "s%|]%\xcc\x83%g" -e "s%]%\xcc\x81\xcc\x94%g" -e "s%]]%\xcc\x80\xcc\x94%g" -e "s%;%\xcc\x93\xcc\x80%g" -e "s%:space:]][0-9]%
&%g"   > $2
I exited X11, went to a plain text virtual terminal and tested it – it worked.
It looks like garbage on the text line, but when I copy the output to X11 – walah!

ΩΗΟ Σοην
1:1 ʼΕν ἀρχῃ̃ η̃̓ν ὁ λόγος καὶ ὁ λόγος η̃̓ν πρὸς τὸν θεόν καὶ θεὸς η̃̓ν ὁ λόγος
2 ου̃̔τος η̃̓ν ἐν ἀρχῃ̃ πρὸς τὸν θεόν
3 πάντα δι αὐτουͅ ἐγένετο καὶ χωρὶς αὐτουͅ ἐγένετο οὐδὲ έ̔ν ὸ̔ γέγονεν

But I must say, this is a rather obscure sed script if you need to change anything!

Hint:Unicode characters are almost ALWAYS two escape sequences long, and they have values of the first escape that are ABOVE the number x7, eg: x8x9xAxBxCxDxExF.
Typical starting chars are \xce and \xcf. Good luck.

And dont forget to put your text terminal in UTF-8 mode…as I described before.

Best wishes,
–Andrew.
 
YES. It would have just been easier to send me an email and try it – but if I am going to bother to reply again… here’s a non-zip fix (courtesty of my Brother who was kind enough to help me as I couldn’t hit the side of a barn right now if I tried…)
All unicode chars are replaced with hex escape sequences.
Code:
#!/bin/bash
cat $1 | sed -e "y%abcdefghijklmnopqrstu!wxyz%\xce\xb1\xce\xb2\xcf\x87\xce\xb4\xce\xb5\xcf\x86\xce\xb3\xce\xb7\xce\xb9\xcf\x82\xce\xba\xce\xbb\xce\xbc\xce\xbd\xce\xbf\xcf\x80\xce\xb8\xcf\x81\xcf\x83\xcf\x84\xcf\x85\x21\xcf\x89\xce\xbe\x21\xce\xb6%" -e "y%ABCDEFGHIJKLMNOPQRSTU!WXYZ%\xce\x91\xce\x92\xce\xa7\xce\x94\xce\x95\xce\xa6\xce\x93\xce\x97\xce\x99\xce\xa3\xce\x9a\xce\x9b\xce\x9c\xce\x9d\xce\x9f\xce\xa0\xce\x98\xce\xa1\xce\xa3\xce\xa4\xce\xa5\x21\xce\xa9\xce\x9e\x21\xce\x96%" -e "s%\]%.%g" -e "s%/|%|/%g" -e "s%V%\xca\xbc%g" -e "s%v%\xcc\x93%g"  -e "s%,%\xcc\x81%g" -e "s%\`%\xcc\x94%g" -e "s%-%\xcc\x83\xcc\x94%g" -e "s%=%\xcc\x83\xcc\x93%g" -e "s%.]%\xcc\x80%g" -e "s%/]%\xcd\x85%g" -e "s%|]%\xcc\x83%g" -e "s%]%\xcc\x81\xcc\x94%g" -e "s%]]%\xcc\x80\xcc\x94%g" -e "s%;%\xcc\x93\xcc\x80%g" -e "s%:space:]][0-9]%
&%g"   > $2
I exited X11, went to a plain text virtual terminal and tested it – it worked.
It looks like garbage on the text line, but when I copy the output to X11 – walah!

ΩΗΟ Σοην
1:1 ʼΕν ἀρχῃ̃ η̃̓ν ὁ λόγος καὶ ὁ λόγος η̃̓ν πρὸς τὸν θεόν καὶ θεὸς η̃̓ν ὁ λόγος
2 ου̃̔τος η̃̓ν ἐν ἀρχῃ̃ πρὸς τὸν θεόν
3 πάντα δι αὐτουͅ ἐγένετο καὶ χωρὶς αὐτουͅ ἐγένετο οὐδὲ έ̔ν ὸ̔ γέγονεν

But I must say, this is a rather obscure sed script if you need to change anything!

Hint:Unicode characters are almost ALWAYS two escape sequences long, and they have values of the first escape that are ABOVE the number x7, eg: x8x9xAxBxCxDxExF.
Typical starting chars are \xce and \xcf. Good luck.

And dont forget to put your text terminal in UTF-8 mode…as I described before.

Best wishes,
–Andrew.
Thank you very much. I was thinking that hex might be compatible with character based applications. That was a lot of work. Thank your brother for me as well.
 
Status
Not open for further replies.
Back
Top