Exemplo n.º 1
0
cst_utterance *default_pause_insertion(cst_utterance *u)
{
    /* Add initial silences and silence at each phrase break */
    const char *silence;
    const cst_item *w;
    cst_item *p, *s;

    silence = val_string(feat_val(u->features,"silence"));

    /* Insert initial silence */
    s = relation_head(utt_relation(u,"Segment"));
    if (s == NULL)
	s = relation_append(utt_relation(u,"Segment"),NULL);
    else
	s = item_prepend(s,NULL);
    item_set_string(s,"name",silence);

    for (p=relation_head(utt_relation(u,"Phrase")); p; p=item_next(p))
    {
	for (w = item_last_daughter(p); w; w=item_prev(w))
	{
	    s = path_to_item(w,"R:SylStructure.daughtern.daughtern.R:Segment");
	    if (s)
	    {
		s = item_append(s,NULL);
		item_set_string(s,"name",silence);
		break;
	    }
	}
    }

    return u;
}
Exemplo n.º 2
0
static void apostrophe_s(cst_utterance *u)
{
    cst_item *s;
    cst_item *schwa;
    const cst_phoneset *ps = u->vox->phoneset;
    const char *pname, *word;

    for (s=item_next(UTT_REL_HEAD(u,SEGMENT));
	 s;
         s=item_next(s))
    {
	word = val_string(ffeature(s, "R:"SYLSTRUCTURE".P.P.name"));
	if (cst_streq("'s", word))
	{
	    pname = item_feat_string(item_prev(s),"name");
	    if ((strchr("fa",*phone_feature_string(ps,pname,"ctype")) != NULL)
		&& (strchr("dbg",
			   *phone_feature_string(ps,pname,"cplace")) == NULL))
		/* needs a schwa */
	    {
		schwa = item_prepend(s,NULL);
		item_set_string(schwa,"name","ax");
		item_prepend(item_as(s,SYLSTRUCTURE),schwa);
	    }
	    else if (cst_streq("-",phone_feature_string(ps,pname,"cvox")))
		item_set_string(s,"name","s");
	}
	else if (cst_streq("'ve", word)
		 || cst_streq("'ll", word)
		 || cst_streq("'d", word))
	{
	    if (cst_streq("-",ffeature_string(s,"p."PH_VC)))
	    {
		schwa = item_prepend(s,NULL);
		item_set_string(schwa,"name","ax");
		item_prepend(item_as(s,SYLSTRUCTURE),schwa);
	    }
	}
    }

}