56 for (r = 0; r < n_ci; r++) {
61 for (r = 0; r < n_ci; r++) {
64 for (tmp_r = 0; tmp_r < r && com_tab[tmp_r] !=
BAD_S3SSID; tmp_r++) {
65 if (uncomp_tab[r] == com_tab[tmp_r]) {
73 com_tab[tmp_r] = uncomp_tab[r];
94 tmpssid = ckd_calloc(n_ci,
sizeof(s3ssid_t));
95 tmpcimap = ckd_calloc(n_ci,
sizeof(
s3cipid_t));
101 for (b = 0; b < n_ci; b++) {
106 for (l = 0; l < n_ci; l++) {
107 rmap = rdiph_rc[b][l];
114 d2p->
rssid[b][l].
ssid = ckd_calloc(r,
sizeof(s3ssid_t));
116 r *
sizeof(s3ssid_t));
131 E_INFO(
"Allocated %d bytes (%d KiB) for word-final triphones\n",
132 (
int)alloc, (
int)alloc / 1024);
138 compress_left_right_context_tree(
dict2pid_t * d2p)
150 tmpssid = ckd_calloc(n_ci,
sizeof(s3ssid_t));
151 tmpcimap = ckd_calloc(n_ci,
sizeof(
s3cipid_t));
159 for (b = 0; b < n_ci; b++) {
165 for (l = 0; l < n_ci; l++) {
174 d2p->
lrssid[b][l].
ssid = ckd_calloc(r,
sizeof(s3ssid_t));
176 r *
sizeof(s3ssid_t));
195 E_INFO(
"Allocated %d bytes (%d KiB) for single-phone word triphones\n",
196 (
int)alloc, (
int)alloc / 1024);
253 free_compress_map(
xwdssid_t ** tree, int32 n_ci)
256 for (b = 0; b < n_ci; b++) {
257 for (l = 0; l < n_ci; l++) {
258 ckd_free(tree[b][l].ssid);
259 ckd_free(tree[b][l].cimap);
272 for (l = 0; l < bin_mdef_n_ciphone(mdef); l++) {
273 for (r = 0; r < bin_mdef_n_ciphone(mdef); r++) {
275 p = bin_mdef_phone_id_nearest(mdef, (
s3cipid_t) b,
280 = bin_mdef_pid2ssid(mdef, p);
281 if (r == bin_mdef_silphone(mdef))
283 = bin_mdef_pid2ssid(mdef, p);
284 if (rdiph_rc && l == bin_mdef_silphone(mdef))
286 = bin_mdef_pid2ssid(mdef, p);
287 assert(IS_S3SSID(bin_mdef_pid2ssid(mdef, p)));
288 E_DEBUG(2,(
"%s(%s,%s) => %d / %d\n",
292 p, bin_mdef_pid2ssid(mdef, p)));
304 if (dict_pronlen(d, wid) > 1) {
308 if (d2p->
ldiph_lc[dict_first_phone(d, wid)][dict_second_phone(d, wid)][0]
310 E_DEBUG(2, (
"Filling in left-context diphones for %s(?,%s)\n",
313 for (l = 0; l < bin_mdef_n_ciphone(mdef); l++) {
315 = bin_mdef_phone_id_nearest(mdef,
316 dict_first_phone(d, wid), l,
317 dict_second_phone(d, wid),
319 d2p->
ldiph_lc[dict_first_phone(d, wid)][dict_second_phone(d, wid)][l]
320 = bin_mdef_pid2ssid(mdef, p);
323 if (d2p->
rssid[dict_last_phone(d, wid)][dict_second_last_phone(d, wid)].n_ssid
330 E_DEBUG(2, (
"Filling in right-context diphones for %s(%s,?)\n",
333 rmap = ckd_calloc(bin_mdef_n_ciphone(mdef),
sizeof(*rmap));
334 for (r = 0; r < bin_mdef_n_ciphone(mdef); r++) {
336 = bin_mdef_phone_id_nearest(mdef,
337 dict_last_phone(d, wid),
338 dict_second_last_phone(d, wid), r,
340 rmap[r] = bin_mdef_pid2ssid(mdef, p);
342 tmpssid = ckd_calloc(bin_mdef_n_ciphone(mdef),
sizeof(*tmpssid));
343 tmpcimap = ckd_calloc(bin_mdef_n_ciphone(mdef),
sizeof(*tmpcimap));
344 compress_table(rmap, tmpssid, tmpcimap, bin_mdef_n_ciphone(mdef));
347 d2p->
rssid[dict_last_phone(d, wid)][dict_second_last_phone(d, wid)].
ssid = tmpssid;
348 d2p->
rssid[dict_last_phone(d, wid)][dict_second_last_phone(d, wid)].
cimap = tmpcimap;
349 d2p->
rssid[dict_last_phone(d, wid)][dict_second_last_phone(d, wid)].
n_ssid = r;
356 E_INFO(
"Filling in context triphones for %s(?,?)\n",
359 populate_lrdiph(d2p, NULL, dict_first_phone(d, wid));
375 if (pos == 0 || pos == dict_pronlen(dict, wid))
381 p = bin_mdef_phone_id_nearest(mdef, (
s3cipid_t) b,
384 return bin_mdef_pid2ssid(mdef, p);
391 s3ssid_t ***rdiph_rc;
392 bitvec_t *ldiph, *rdiph, *single;
396 E_INFO(
"Building PID tables for dictionary\n");
401 dict2pid->refcount = 1;
404 E_INFO(
"Allocating %d^3 * %d bytes (%d KiB) for word-initial triphones\n",