~ubuntu-branches/ubuntu/oneiric/festival/oneiric

« back to all changes in this revision

Viewing changes to src/modules/base/phrasify.cc

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Moog
  • Date: 2011-05-04 20:54:27 UTC
  • mfrom: (3.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110504205427-puyrclwmtswscsyw
Tags: 1:2.1~release-1ubuntu1
* Merge from debian/unstable, remaining change:
  - debian/control: Drop file-rc as an alternative to
    sysv-rc as Ubuntu doesn't support it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
 
104
104
    u->create_relation("Phrase");
105
105
 
106
 
    for (w=u->relation("Word")->first(); w != 0; w = next(w))
 
106
    for (w=u->relation("Word")->first(); w != 0; w = w->next())
107
107
    {
108
108
        if (phr == 0)
109
109
            phr = add_phrase(u);
110
110
        append_daughter(phr,"Phrase",w);
111
 
        if (next(w) == 0)
 
111
        if (w->next() == 0)
112
112
        {
113
113
            w->set("pbreak","B");
114
114
            phr->set_name("4");
127
127
    u->create_relation("Phrase");
128
128
    tree = siod_get_lval("phrase_cart_tree","no phrase cart tree");
129
129
 
130
 
    for (w=u->relation("Word")->first(); w != 0; w = next(w))
 
130
    for (w=u->relation("Word")->first(); w != 0; w = w->next())
131
131
    {
132
132
        if (phr == 0)
133
133
            phr = add_phrase(u);
209
209
    pbyp_get_params(siod_get_lval("phr_break_params",NULL));
210
210
    gc_protect(&bb_tags);
211
211
 
212
 
    for (w=u->relation("Word")->first(); w != 0; w = next(w))
 
212
    for (w=u->relation("Word")->first(); w != 0; w = w->next())
213
213
    {   // Set up tag index for pos ngram
214
214
        EST_String lpos = map_pos(pos_map,w->f("pos").string());
215
215
        w->set("phr_pos",lpos);
228
228
 
229
229
    // Given predicted break, go through and add phrases 
230
230
    u->create_relation("Phrase");
231
 
    for (w=u->relation("Word")->first(); w != 0; w = next(w))
 
231
    for (w=u->relation("Word")->first(); w != 0; w = w->next())
232
232
    {
233
233
        w->set("pbreak",bb_ngram->
234
234
                 get_vocab_word(w->f("pbreak_index").Int()));
266
266
    if (bb_pos_ngram->order() == 4)
267
267
    {
268
268
        window[1] = s->I("pos_index",0);
269
 
        if (prev(s) != 0)
270
 
            window[0] = prev(s)->I("pos_index",0);
 
269
        if (s->prev() != 0)
 
270
            window[0] = s->prev()->I("pos_index",0);
271
271
        else
272
272
            window[0] = pos_p_start_tag;
273
 
        if (next(s) != 0)
274
 
            window[2] = next(s)->I("pos_index",0);
 
273
        if (s->next() != 0)
 
274
            window[2] = s->next()->I("pos_index",0);
275
275
        else
276
276
            window[2] = pos_n_start_tag;
277
277
    }
278
278
    else if (bb_pos_ngram->order() == 3)
279
279
    {
280
280
        window[0] = s->I("pos_index",0);
281
 
        if (next(s) != 0)
282
 
            window[1] = next(s)->I("pos_index",0);
 
281
        if (s->next() != 0)
 
282
            window[1] = s->next()->I("pos_index",0);
283
283
        else
284
284
            window[1] = pos_n_start_tag;
285
285
    }
286
286
    else if (bb_pos_ngram->order() == 5)
287
287
    {   // This is specific for some set of pos tagsets
288
288
        window[2] = s->I("pos_index",0);
289
 
        if (prev(s) != 0)
 
289
        if (s->prev() != 0)
290
290
        {
291
 
            window[1] = prev(s)->I("pos_index",0);
 
291
            window[1] = s->prev()->I("pos_index",0);
292
292
        }
293
293
        else
294
294
        {
295
295
            window[1] = pos_p_start_tag;
296
296
        }
297
 
        if (next(s) != 0)
 
297
        if (s->next() != 0)
298
298
        {
299
 
            window[3] = next(s)->I("pos_index",0);
300
 
            if (next(next(s)) != 0)
301
 
                window[0] = next(next(s))->I("pos_index",0);
 
299
            window[3] = s->next()->I("pos_index",0);
 
300
            if (s->next()->next() != 0)
 
301
                window[0] = s->next()->next()->I("pos_index",0);
302
302
            else
303
303
                window[0] = 0;
304
304
        }
328
328
        c->next = all_c;
329
329
        all_c = c;  // but then if you give only one option ...
330
330
    }
331
 
    else if (next(s) == 0)  // end of utterances so force a break
 
331
    else if (s->next() == 0)  // end of utterances so force a break
332
332
    {   
333
333
        EST_VTCandidate *c = new EST_VTCandidate;
334
334
        c->s = s;
634
634
    pbyp_get_params(siod_get_lval("phr_break_params",NULL));
635
635
    gc_protect(&bb_tags);
636
636
 
637
 
    for (w=u->relation("Word")->first(); w != 0; w = next(w))
 
637
    for (w=u->relation("Word")->first(); w != 0; w = w->next())
638
638
    {   // Set up tag index for pos ngram
639
639
        EST_String lpos = map_pos(pos_map,w->f("pos").string());
640
640
        w->set("phr_pos",lpos);
651
651
 
652
652
    // Given predicted break, go through and add phrases 
653
653
    u->create_relation("Phrase");
654
 
    for (w=u->relation("Word")->first(); w != 0; w = next(w))
 
654
    for (w=u->relation("Word")->first(); w != 0; w = w->next())
655
655
    {
656
656
        w->set("pbreak",bb_ngram->
657
657
                 get_vocab_word(w->f("pbreak_index").Int()));