#!/vol/perl/bin/perl -w # praat to sampa ipa font converter # By Thorsten Trippel # University of Bielefeld # ttrippel@spectrum.uni-bielefeld.de # May 2001 # # This program requires perl 5.6 or higher, # tested on perl 5.6.0 build for sun4-solaris # # # This program is a pure font converter, using SAMPA-IPA symbols as input, # read from input file, and produces coresponding PRAAT-IPA-notation, # which are ASCII combinations, send to STDOUT # # Usage: praat2sampa.pl INPUTFILE # # The PRAAT manual does not specify the following # characters (which are existend in the IPA chart with # symbols in SAMPA notation): # O\ |\ !\ =\ |\|\ p_> t_> k_> s_> x\ @\ 3\ # Beginning of translation table %praat2sampa= ( "\\\\c\," => "C", "\\\\l\-" => "K", "\\\\lz" => "K\\", "\\\\lc" => "L\\", "\\\\9\-" => "<\\", "\\\\9e" => "?\\", "\\\\l\\." => "l`", "\\\\\\?g" => "?", "\\\\G\\^" => "G\_<", "\\\\ab" => "Q", "\\\\ae" => "{", "\\\\as" => "A", "\\\\at" => "6", "\\\\b\\^" => "b_<", "\\\\bc" => "B\\", "\\\\be" => "B", "\\\\cc" => "s\\", "\\\\ci" => "X", "\\\\ct" => "O", "\\\\d\\." => "d`", "\\\\d\\^" => "d_<", "\\\\dh" => "D", "\\\\ep" => "E", "\\\\er" => "3", "\\\\f\\." => "r`", "\\\\f2" => "p\\", "\\\\fh" => "4", "\\\\g\\^" => "g_<", "\\\\ga" => "G", "\\\\gc" => "G\\", "\\\\gs" => "g", "\\\\h\-" => "X\\", "\\\\h\\^" => "h\\", "\\\\hc" => "H\\", "\\\\hs" => "U", "\\\\ht" => "H", "\\\\i\-" => "1", "\\\\ic" => "I", "\\\\j\-" => "J\\", "\\\\j\\^" => "J\\_<", "\\\\jc" => "j\\", "\\\\\\?\-" => ">\\", "\\\\l\~" => "5", "\\\\mj" => "F", "\\\\ml" => "M\\", "\\\\mt" => "M", "\\\\n\\." => "n`", "\\\\nc" => "N\\", "\\\\ng" => "N", "\\\\nj" => "J", "\\\\o\-" => "8", "\\\\o/" => "2", "\\\\oe" => "9", "\\\\r\\." => "r\\`", "\\\\rc" => "R\\", "\\\\rh" => "7", "\\\\ri" => "R", "\\\\rl" => "l\\", "\\\\rt" => "r\\", "\\\\s\\." => "s`", "\\\\sh" => "S", "\\\\sr" => "`(@`)", "\\\\sw" => "@", "\\\\t\\." => "t`", "\\\\te" => "T", "\\\\u\-" => "}", "\\\\vs" => "P", "\\\\vt" => "V", "\\\\wt" => "W", "\\\\yc" => "Y", "\\\\yt" => "L", "\\\\z\\." => "z`", "\\\\zc" => "z\\", "\\\\zh" => "Z", "a" => "a", "b" => "b", "c" => "c", "d" => "d", "d\\\\cn" => "_}(t_})", "e" => "e", "f" => "f", "h" => "h", "i" => "i", "j" => "j", "k" => "k", "k\\\\lip" => "_", "l" => "l", "m" => "m", "n" => "n", "notspecified" => "!\\", "notspecified" => "3\\", "notspecified" => "=\\", "notspecified" => "@\\", "notspecified" => "O\\", "notspecified" => "k_>", "notspecified" => "p_>", "notspecified" => "s_>", "notspecified" => "t_>", "notspecified" => "x\\", "notspecified" => "|\\", "o" => "o", "o\\\\T\\^" => "_r(e_r)", "o\\\\Tv" => "_oe_o", "p" => "p", "q" => "q", "r" => "r", "s" => "s", "t" => "t", "u" => "u", "v" => "v", "w" => "w", "x" => "x", "y" => "y", "z" => "z", "n\\\\\\|v" => "\_=", ); # Processing loop # This is the major function reading the input and replacing a string from # the translation table one at a time while (<>){ $var=$_; while (($praat,$sampa)= each(%praat2sampa)) { $var=~s#$praat#$sampa#; }; print "$var\n"; }; # End of function # EOF