/usr/include/sphinxtrain/dtree.h is in sphinxtrain-dev 1.0.8-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | /* ====================================================================
* Copyright (c) 1997-2000 Carnegie Mellon University. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* This work was supported in part by funding from the Defense Advanced
* Research Projects Agency and the National Science Foundation of the
* United States of America, and the CMU Sphinx Speech Consortium.
*
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
* ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
* NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
*/
/*********************************************************************
*
* File: dtree.h
*
* Description:
*
* Author:
*
*********************************************************************/
#ifndef DTREE_H
#define DTREE_H
#ifdef __cplusplus
extern "C" {
#endif
#if 0
}
#endif
#include <s3/dtree.h>
#include <s3/pset_io.h>
#include <sphinxbase/prim_type.h>
#include <s3/acmod_set.h>
#include <s3/quest.h>
#define NO_CLUST (0xffffffff)
typedef struct dtree_node_str {
uint32 node_id;
uint32 clust; /* If simple tree, which cluster (0 or 1) does
this leaf node belong to.
If complex tree and a leaf node, clust is the
tied state id of the node */
uint32 *id; /* id's of triphones represented by this node */
uint32 n_id; /* # of triphones represented */
float32 ***mixw_occ;
float32 ***means;
float32 ***vars;
float32 occ; /* # of time state is observed */
float64 wt_ent; /* weighted entropy of this node */
void *q; /* best question for this node */
float64 wt_ent_dec; /* Weighted entropy decrease of doing split */
struct dtree_node_str *p; /* parent node */
struct dtree_node_str *y; /* yes child node */
struct dtree_node_str *n; /* no child node */
} dtree_node_t;
#define IS_LEAF(nd) ((((nd)->y == NULL) && ((nd)->n == NULL)))
#define IS_TWIG(nd) (!IS_LEAF(nd) && IS_LEAF((nd)->y) && IS_LEAF((nd)->n))
typedef struct dtree_s {
dtree_node_t *node;
uint32 n_node;
} dtree_t;
uint32
cnt_node(dtree_node_t *node);
uint32
reindex(dtree_node_t *node,
uint32 *next_id);
uint32
cnt_leaf(dtree_node_t *node);
uint32
label_leaves(dtree_node_t *node, uint32 *id);
dtree_node_t *
get_node(dtree_node_t *node,
uint32 id);
uint32
tied_state(dtree_node_t *node,
acmod_id_t b,
acmod_id_t l,
acmod_id_t r,
word_posn_t wp,
pset_t *pset);
uint32
cnt_twig(dtree_node_t *node);
void
print_node(FILE *fp,
dtree_node_t *node,
pset_t *pset);
void
print_node_comp(FILE *fp,
dtree_node_t *node,
pset_t *pset);
void
print_final_tree(FILE *fp,
dtree_node_t *node,
pset_t *pset);
void
print_final_tree_davinci(FILE *fp,
dtree_node_t *node,
pset_t *pset);
dtree_t *
read_final_tree(FILE *fp,
pset_t *pset,
uint32 n_pset);
void
free_tree(dtree_t *tr);
void
print_tree(FILE *fp,
char *label,
dtree_node_t *node,
pset_t *pset,
uint32 lvl);
void
print_tree_comp(FILE *fp,
char *label,
dtree_node_t *node,
pset_t *pset,
uint32 lvl);
int
mk_node(dtree_node_t *node,
uint32 node_id,
uint32 *id,
uint32 n_id,
float32 ****mixw,
float32 ****means,
float32 ****vars,
uint32 *veclen,
uint32 n_model,
uint32 n_state,
uint32 n_stream,
uint32 n_density,
float32 *stwt,
float32 mwfloor);
float64
set_best_quest(dtree_node_t *node,
float32 ****mixw,
float32 ****means,
float32 ****vars,
uint32 *veclen,
uint32 n_model,
uint32 n_state,
uint32 n_stream,
uint32 n_density,
float32 *stwt,
quest_t *all_q,
uint32 n_all_q,
pset_t *pset,
uint32 **dfeat,
uint32 n_dfeat,
float32 mwfloor);
dtree_t *
mk_tree(float32 ****mixw,
float32 ****means,
float32 ****vars,
uint32 *veclen,
uint32 n_model,
uint32 n_state,
uint32 n_stream,
uint32 n_density,
float32 *stwt,
uint32 *id,
uint32 n_id,
quest_t *all_q,
uint32 n_all_q,
pset_t *pset,
uint32 **dfeat,
uint32 n_dfeat,
uint32 max_split,
uint32 min_split,
float32 split_thr,
float32 mwfloor);
dtree_t *
mk_tree_comp(float32 ****mixw,
float32 ****means,
float32 ****vars,
uint32 *veclen,
uint32 n_model,
uint32 n_state,
uint32 n_stream,
uint32 n_density,
float32 *stwt,
uint32 *id,
uint32 n_id,
quest_t *all_q,
uint32 n_all_q,
pset_t *pset,
uint32 n_base_phone,
uint32 **dfeat,
uint32 n_dfeat,
uint32 split_min,
uint32 split_max,
float32 split_thr,
uint32 split_min_comp,
uint32 split_max_comp,
float32 split_thr_comp,
float32 mwfloor);
void
cluster_leaves(dtree_t *tr,
uint32 *veclen,
float64 *wt_ent_dec,
uint32 *out_n_a,
uint32 *out_n_b,
pset_t *pset,
uint32 n_state,
uint32 n_stream,
uint32 n_density,
float32 *stwt,
float32 mwfloor);
void
split_node_comp(dtree_t *tr,
uint32 node_id,
float32 ****mixw,
float32 ****means,
float32 ****vars,
uint32 *veclen,
uint32 n_model,
uint32 n_state,
uint32 n_stream,
uint32 n_density,
float32 *stwt,
quest_t *all_q,
uint32 n_all_q,
pset_t *pset,
uint32 n_base_phone,
uint32 **dfeat,
uint32 n_dfeat,
uint32 split_min,
uint32 split_max,
float32 split_thr,
float32 mwfloor);
void
split_node(dtree_t *tr,
uint32 node_id,
float32 ****mixw,
float32 ****means,
float32 ****vars,
uint32 *veclen,
uint32 n_model,
uint32 n_state,
uint32 n_stream,
uint32 n_density,
float32 *stwt,
quest_t *all_q,
uint32 n_all_q,
pset_t *pset,
uint32 **dfeat,
uint32 n_dfeat,
float32 mwfloor);
int
split_node_nobest(dtree_t *tr,
uint32 node_id,
float32 ****mixw,
uint32 n_model,
uint32 n_state,
uint32 n_stream,
uint32 n_density,
float32 *stwt,
uint32 **dfeat,
uint32 n_dfeat);
comp_quest_t *
mk_comp_quest(float64 *wt_ent_dec,
float32 ****mixw,
float32 ****means,
float32 ****vars,
uint32 *veclen,
uint32 n_model,
uint32 n_state,
uint32 n_stream,
uint32 n_density,
float32 *stwt,
uint32 *id,
uint32 n_id,
quest_t *all_q,
uint32 n_all_q,
pset_t *pset,
uint32 n_base_phone,
uint32 **dfeat,
uint32 n_dfeat,
uint32 split_min,
uint32 split_max,
float32 split_thr,
float32 mwfloor);
int
ins_twigs(dtree_node_t *node,
uint32 phnid,
uint32 state,
float32 *twig_heap,
uint32 *twig_hkey,
uint32 *phnidlst,
uint32 *statelst,
uint32 *nidlst,
uint32 *free_key);
uint32
prune_subtrees(dtree_node_t *node);
uint32
prune_lowcnt(dtree_node_t *node, float32 cnt_thr);
uint32
leaf_mean_vars(dtree_node_t *node,
pset_t *pset,
float32 ****means,
float32 ****vars,
uint32 *node_id,
uint32 n_state,
uint32 n_stream,
uint32 *veclen,
uint32 off);
#ifdef __cplusplus
}
#endif
#endif /* DTREE_H */
|