#!/usr/bin/gawk -f function phon_add_sep(ph_desc,ph, # real arguments new_desc,l,p) # local variables {new_desc = ""; while(ph_desc != "") {for(l=ph[""];!((p=substr(ph_desc,1,l)) in ph);l--); if(l == 0) {printf("WARNING: unknown phoneme '%.4s...' found\n",ph_desc) > "/dev/stderr"; p = substr(ph_desc,1,l=1); # avoid inf. loop by eating away 1 character } new_desc = (new_desc " " p); ph_desc = substr(ph_desc,l+1); } return(substr(new_desc,2)); } BEGIN { if(ARGC != 3) {printf("Use: PHON_PARSE_EXAMPLE \n") > "/dev/stderr"; exit(1); } # read phoneme list # ph[...] = hash table (assoc. array) containing all known phoneme symbols # SPECIAL: ph[""] = max length over all phonemes fname = ARGV[1]; while((getlineph[""])) ph[""] = l; close(fname); # process the lexicon fname = ARGV[2]; while((getline