#!/usr/bin/gawk -f BEGIN { if(ARGC != 4) {printf("Use: CMUDICT2ESAT \n") > "/dev/stderr"; exit(1); } # read the reference lexicon fname = (ARGV[1]!="-")?ARGV[1]:"/dev/stdin"; for(i=0;(getline "/dev/stderr"; # read phone conversion table fname = (ARGV[3]!="-")?ARGV[3]:"/dev/stdin"; pcvt[".|."] = pcvt["|."] = pcvt[""] = ""; pcvtl = 3; while(getline pcvtl) pcvtl = l; } close(fname); # read the CMU-dictionary fname = (ARGV[2]!="-")?ARGV[2]:"/dev/stdin"; while(getline "/dev/stderr"; l = 1; } } if((i=w2i[w]) in i2p) i2p[i] = (i2p[i] "/" p); else i2p[i] = p; } close(fname); # write the result for(i=0;i in i2w;i++) {if(!(i in i2p)) printf("ERROR: word '%s' has no phonetic transcription\n",i2w[i]) > "/dev/stderr"; if((p=i2p[i]) ~ "/") p = ("[" p "]"); else if(p == "") p = "#"; printf("%s\t%s\n",i2w[i],p); } exit(0); }