Replace one alphabet with another via AppleScript

I use an online Yiddish dictionary from time to time that I think is very good, but unfortunately it uses a the site author’s own system of transliteration rather than the Yiddish letters themselves. This means that each time I want to look up a word, I have to refer to the site guide on how to transliterate the original Yiddish into English letters.

http://www.cs.uky.edu/~raphael/yiddish/dictionary.cgi

I’d like to write an AppleScript that will take the Yiddish words I type in and render them into the transliteration system the author has set up and then look up the word.

I’ve been able to find various examples of scripts that will substitute a given word for another in a text in a rather finite way, but nothing that seems to fit the following bill:

if אַ is typed then substitute a
if ב is typed then substitute b
etc.

You get the idea.

This would allow me to modify one of my existing AppleScript tools to accept Yiddish input, convert it to the author’s transliterated system, open a new web page, load the address, paste in the word and look it up. A great time saver.

Can anyone advise the best way to approach/realise the above idea? Would a bash script run in Automator be a better idea?

Thanks,

Bowjest

Hi,

One strategy would be to use SED to substitute letter by letter.


set theText to "HelLo woRlD"
do shell script "echo " & theText & " | sed y/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/"

Michael

Hi Michael,

Wow! Thanks for the quick response. I’ll give that a try and let you know what I find.

More in a bit,

Bowjest