/usr/include/sphinxtrain/acmod_set.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 | /* ====================================================================
* Copyright (c) 1995-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: acmod_set.h
*
* Description:
* This header defines the interface to the acmod_set (acoustic
* model set) module. See acmod_set.c for the detailed
* descriptions of each function below.
*
* Author:
* Eric H. Thayer (eht@cs.cmu.edu)
*********************************************************************/
#ifndef ACMOD_SET_H
#define ACMOD_SET_H
#ifdef __cplusplus
extern "C" {
#endif
#if 0
}
#endif
#include <sphinxbase/prim_type.h>
typedef unsigned char ci_acmod_id_t;
#define NO_CI_ACMOD (0xff)
#define MAX_CI_ACMOD (0xfe)
typedef uint32 acmod_id_t;
#define NO_ACMOD (0xffffffff) /* The ID representing no acoustic
* model. */
#define MAX_ACMOD (0xfffffffe) /* The max ID possible */
typedef enum {
WORD_POSN_BEGIN = 0, /* beginning phone of word */
WORD_POSN_END = 1, /* ending phone of word */
WORD_POSN_SINGLE = 2, /* single phone word (i.e. begin & end) */
WORD_POSN_INTERNAL = 3, /* internal phone of word */
WORD_POSN_UNDEFINED = 4 /* undefined value, used for initial conditions, etc */
} word_posn_t;
#define N_WORD_POSN 4 /* total # of word position indicators (excluding undefined) */
/* the following map must be consistent w/ the types above. Unpredictable
* behaviour w/ result if not. */
#define WORD_POSN_CHAR_MAP "besiu" /* b == begin, e == end, s == single-phone
i == word-internal, u == undefined */
/* acoustic model record (describes triphones, diphones, etc.) */
typedef struct acmod_s {
ci_acmod_id_t base; /* The base phone associated w/ this phone */
ci_acmod_id_t left_context; /* The left context associated w/ this phone,
* if there is no specified left context, this
* is set to NO_ACMOD */
ci_acmod_id_t right_context; /* The right context associated w/ this phone,
* This can be any CI phone id or NO_ACMOD.
* NO_ACMOD indicates to specified right context */
word_posn_t posn; /* Word position indicator (see above) */
/* The name is generatable from the information above */
char **attrib; /* A NULL terminated list of C strings which
* represent various attributes of the acoustic model.
* For instance, "ci", "non_speech", "triphone"
* model. */
} acmod_t;
/* ci_acmod record (represents base phones and filler words) */
typedef struct ci_acmod_s {
char *name; /* A C string representation for the acoustic model */
char **attrib; /* A NULL terminated list of C strings which
* represent various attributes of the acoustic model.
* For instance, "ci", "non_speech", "triphone"
* model. */
ci_acmod_id_t id; /* The ID of this acoustic model */
} ci_acmod_t;
#include <s3/itree.h>
typedef struct acmod_set_s {
ci_acmod_t *ci; /* base phone and filler model list.
* The base phone set are used to compose
* triphones, diphones, etc. They are also
* acoustic models themselves that represent
* phones trained with no regard to their
* left and right contexts.
*
* filler models are used to represent non-speech
* signals such as silence (actually stationary
* background noise), coughs, door slams, etc. */
uint32 n_ci; /* # of CI acoustic models */
uint32 max_n_ci;
acmod_t *multi; /* The remaining acoustic models. Includes only
* triphones at the moment. */
uint32 n_multi;
uint32 max_n_multi;
uint32 next_id; /* The ID which would be assigned to the next
* new acoustic model */
itree_t **multi_idx; /* A quick index for mapping a multiphone to
* an ID. */
char **attrib; /* A NULL terminated list of C strings which
* represent all possible attributes of the phones in
* a phone set.
* For instance, "base", "non_speech", "triphone" */
uint32 *n_with; /* The number of phones having each attribute. */
} acmod_set_t;
acmod_set_t *
acmod_set_new(void);
int32
acmod_set_set_n_ci_hint(acmod_set_t *acmod_set,
uint32 n_ci_hint);
int32
acmod_set_set_n_tri_hint(acmod_set_t *acmod_set,
uint32 n_tri_hint);
acmod_id_t
acmod_set_add_ci(acmod_set_t *acmod_set,
const char *name,
const char **attrib);
acmod_id_t
acmod_set_add_tri(acmod_set_t *acmod_set,
acmod_id_t base,
acmod_id_t left_context,
acmod_id_t right_context,
word_posn_t posn,
const char **attrib);
acmod_id_t
acmod_set_name2id(acmod_set_t *acmod_set,
const char *name);
const char *
acmod_set_id2name(acmod_set_t *acmod_set,
acmod_id_t id);
const char *
acmod_set_id2fullname(acmod_set_t *acmod_set,
acmod_id_t id);
const char *
acmod_set_id2s2name(acmod_set_t *acmod_set,
acmod_id_t id);
acmod_id_t
acmod_set_enum_init(acmod_set_t *acmod_set,
acmod_id_t base);
acmod_id_t
acmod_set_enum(void);
acmod_id_t
acmod_set_tri2id(acmod_set_t *acmod_set,
acmod_id_t base,
acmod_id_t left_context,
acmod_id_t right_context,
word_posn_t posn);
int32
acmod_set_id2tri(acmod_set_t *acmod_set,
acmod_id_t *base,
acmod_id_t *left_context,
acmod_id_t *right_context,
word_posn_t *posn,
acmod_id_t id);
const char *
acmod_set_s2_id2name(acmod_set_t *acmod_set,
acmod_id_t id);
uint32
acmod_set_n_acmod(acmod_set_t *acmod_set);
uint32
acmod_set_n_base_acmod(acmod_set_t *acmod_set);
uint32
acmod_set_n_multi(acmod_set_t *acmod_set);
uint32
acmod_set_n_ci(acmod_set_t *acmod_set);
acmod_id_t
acmod_set_base_phone(acmod_set_t *acmod_set,
acmod_id_t id);
uint32
acmod_set_has_attrib(acmod_set_t *acmod_set,
acmod_id_t id,
const char *attrib);
const char **
acmod_set_attrib(acmod_set_t *acmod_set,
acmod_id_t id);
int
acmod_set_s2_parse_triphone(acmod_set_t *acmod_set,
acmod_id_t *base,
acmod_id_t *left,
acmod_id_t *right,
word_posn_t *posn,
char *str);
#ifdef __cplusplus
}
#endif
#endif /* ACMOD_SET_H */
|