/* file pronphon.c */

#if !defined(COMPILE_ENVIRONMENT)
#include <gp/stdcenvf.h> /* std compile environment for functions */
#endif

boolean pronounceable_phon(char *ph, struct SYL_PARMS *syl_parms)
/***************************************************************/
/* Returns T iff English phonological rep *ph is pronounceable */
/***************************************************************/
{char *proc = "pronounceable_phon";
 char phxx[LINE_LENGTH], *phx = &phxx[0];
 char sxdbx[LINE_LENGTH], *sxdb = &sxdbx[0];
 int err, *perr = &err;
 int xintdb[MAX_SYMBS_IN_STR+1];
 boolean pronounceable = T;
 struct PRON2 xpron_data, *xpron = &xpron_data;
db_enter_msg(proc,1); /* debug only */
if (db_level > 2) printf("%s ph='%s'\n",pdb,ph);
if (textlen(ph) < 1)
  {pronounceable = F;
   goto RETURN;
  }
/* add beginning & ending word boundaries */
 sprintf(phx,"$## %s ##$",ph);
 make_basic_pron4(xpron,phx,syl_parms,perr);
 if (*perr > 0) fatal_error(proc,"make_basicPron2 error return",*perr);

if (db_level > 1) /* print out syllabified pron */
  {fold_tiers2(xintdb,xpron,syl_parms->lmark,syl_parms->rmark,syl_parms->wbound);
   decode2(sxdb,LINE_LENGTH,syl_parms->pcdp,xintdb,&xintdb[0],perr);
   printf("%s Basic pron is /%s/\n",pdb,sxdb);
  }
 /* assume that if basic pron syllabification won't work, no higher rate one will */
 if (stranded_segment(xpron)) pronounceable = F;  
RETURN:
if (db_level > 1) printf("%s at return, pronounceable=%s\n",pdb,bool_print(pronounceable));
db_leave_msg(proc,1); /* debug only */
 return (pronounceable);
}
