SphinxBase
5prealpha
ngrams_raw.h
1
/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
/* ====================================================================
3
* Copyright (c) 2015 Carnegie Mellon University. All rights
4
* reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
8
* are met:
9
*
10
* 1. Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
*
13
* 2. Redistributions in binary form must reproduce the above copyright
14
* notice, this list of conditions and the following disclaimer in
15
* the documentation and/or other materials provided with the
16
* distribution.
17
*
18
* This work was supported in part by funding from the Defense Advanced
19
* Research Projects Agency and the National Science Foundation of the
20
* United States of America, and the CMU Sphinx Speech Consortium.
21
*
22
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
23
* ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
26
* NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*
34
* ====================================================================
35
*
36
*/
37
38
#ifndef __NGRAMS_RAW_H__
39
#define __NGRAMS_RAW_H__
40
41
#include <
sphinxbase/hash_table.h
>
42
#include <
sphinxbase/logmath.h
>
43
#include <
sphinxbase/prim_type.h
>
44
#include <
sphinxbase/pio.h
>
45
#include <
sphinxbase/err.h
>
46
47
typedef
struct
ngram_raw_s
{
48
uint32 *words;
/* array of word indexes, length corresponds to ngram order */
49
float32 prob;
50
float32 backoff;
51
uint32 order;
52
}
ngram_raw_t
;
53
54
typedef
union
{
55
float32 f;
56
int32 l;
57
}
dmp_weight_t
;
58
62
int
ngram_ord_comparator(
const
void
*a_raw,
const
void
*b_raw);
63
73
ngram_raw_t
**ngrams_raw_read_arpa(
lineiter_t
** li,
logmath_t
* lmath,
74
uint32 * counts,
int
order,
75
hash_table_t
* wid);
76
87
ngram_raw_t
**ngrams_raw_read_dmp(FILE * fp,
logmath_t
* lmath,
88
uint32 * counts,
int
order,
89
uint32 * unigram_next, uint8 do_swap);
90
91
void
ngrams_raw_free(
ngram_raw_t
** raw_ngrams, uint32 * counts,
92
int
order);
93
94
#endif
/* __LM_NGRAMS_RAW_H__ */
prim_type.h
Basic type definitions used in Sphinx.
logmath.h
Fast integer logarithmic addition operations.
dmp_weight_t
Definition:
ngrams_raw.h:54
err.h
Implementation of logging routines.
ngram_raw_s
Definition:
ngrams_raw.h:47
hash_table_s
Definition:
hash_table.h:159
pio.h
file IO related operations.
logmath_s
Definition:
logmath.c:49
lineiter_t
Line iterator for files.
Definition:
pio.h:177
hash_table.h
Hash table implementation.
src
libsphinxbase
lm
ngrams_raw.h
Generated by
1.8.17