SphinxBase 0.6
ngram_model_s Struct Reference

Common implementation of ngram_model_t. More...

#include <ngram_model_internal.h>

Data Fields

int refcount
 Reference count.
 
int32 * n_counts
 Counts for 1, 2, 3, ... grams.
 
int32 n_1g_alloc
 Number of allocated word strings (for new word addition)
 
int32 n_words
 Number of actual word strings (NOT the same as the number of unigrams, due to class words).
 
uint8 n
 This is an n-gram model (1, 2, 3, ...).
 
uint8 n_classes
 Number of classes (maximum 128)
 
uint8 writable
 Are word strings writable?
 
uint8 flags
 Any other flags we might care about (FIXME: Merge this and writable)
 
logmath_tlmath
 Log-math object.
 
float32 lw
 Language model scaling factor.
 
int32 log_wip
 Log of word insertion penalty.
 
int32 log_uw
 Log of unigram weight.
 
int32 log_uniform
 Log of uniform (0-gram) probability.
 
int32 log_uniform_weight
 Log of uniform weight (i.e.
 
int32 log_zero
 Zero probability, cached here for quick lookup.
 
char ** word_str
 Unigram names.
 
hash_table_twid
 Mapping of unigram names to word IDs.
 
int32 * tmp_wids
 Temporary array of word IDs for ngram_model_get_ngram()
 
struct ngram_class_s ** classes
 Word class definitions.
 
struct ngram_funcs_sfuncs
 Implementation-specific methods.
 

Detailed Description

Common implementation of ngram_model_t.

The details of bigram, trigram, and higher-order N-gram storage, if any, can vary somewhat depending on the file format in use.

Definition at line 55 of file ngram_model_internal.h.

Field Documentation

◆ classes

struct ngram_class_s** ngram_model_s::classes

Word class definitions.

Definition at line 76 of file ngram_model_internal.h.

Referenced by ngram_model_add_class(), ngram_model_add_class_word(), ngram_model_free(), ngram_ng_prob(), and ngram_ng_score().

◆ flags

uint8 ngram_model_s::flags

Any other flags we might care about (FIXME: Merge this and writable)

Definition at line 64 of file ngram_model_internal.h.

◆ funcs

◆ lmath

◆ log_uniform

int32 ngram_model_s::log_uniform

Log of uniform (0-gram) probability.

Definition at line 70 of file ngram_model_internal.h.

◆ log_uniform_weight

int32 ngram_model_s::log_uniform_weight

Log of uniform weight (i.e.

1 - unigram weight)

Definition at line 71 of file ngram_model_internal.h.

◆ log_uw

int32 ngram_model_s::log_uw

Log of unigram weight.

Definition at line 69 of file ngram_model_internal.h.

Referenced by ngram_model_get_weights().

◆ log_wip

int32 ngram_model_s::log_wip

Log of word insertion penalty.

Definition at line 68 of file ngram_model_internal.h.

Referenced by ngram_model_get_weights(), and ngram_score_to_prob().

◆ log_zero

int32 ngram_model_s::log_zero

Zero probability, cached here for quick lookup.

Definition at line 72 of file ngram_model_internal.h.

Referenced by ngram_model_add_word(), ngram_model_set_remove(), ngram_ng_prob(), ngram_ng_score(), and ngram_zero().

◆ lw

float32 ngram_model_s::lw

Language model scaling factor.

Definition at line 67 of file ngram_model_internal.h.

Referenced by ngram_model_get_weights(), and ngram_score_to_prob().

◆ n

uint8 ngram_model_s::n

◆ n_1g_alloc

int32 ngram_model_s::n_1g_alloc

Number of allocated word strings (for new word addition)

Definition at line 58 of file ngram_model_internal.h.

Referenced by ngram_model_set_map_words().

◆ n_classes

uint8 ngram_model_s::n_classes

Number of classes (maximum 128)

Definition at line 62 of file ngram_model_internal.h.

Referenced by ngram_model_add_class(), ngram_model_add_class_word(), and ngram_model_free().

◆ n_counts

int32* ngram_model_s::n_counts

Counts for 1, 2, 3, ... grams.

Definition at line 57 of file ngram_model_internal.h.

Referenced by ngram_model_free(), and ngram_model_get_counts().

◆ n_words

int32 ngram_model_s::n_words

Number of actual word strings (NOT the same as the number of unigrams, due to class words).

Definition at line 59 of file ngram_model_internal.h.

Referenced by ngram_model_casefold(), ngram_model_free(), ngram_model_set_add(), ngram_model_set_current_wid(), ngram_model_set_known_wid(), ngram_model_set_map_words(), ngram_model_set_remove(), and ngram_word().

◆ refcount

int ngram_model_s::refcount

Reference count.

Definition at line 56 of file ngram_model_internal.h.

Referenced by ngram_model_free(), and ngram_model_retain().

◆ tmp_wids

int32* ngram_model_s::tmp_wids

Temporary array of word IDs for ngram_model_get_ngram()

Definition at line 75 of file ngram_model_internal.h.

◆ wid

hash_table_t* ngram_model_s::wid

Mapping of unigram names to word IDs.

Definition at line 74 of file ngram_model_internal.h.

Referenced by ngram_model_casefold(), ngram_model_free(), ngram_model_set_map_words(), ngram_unknown_wid(), and ngram_wid().

◆ word_str

char** ngram_model_s::word_str

◆ writable

uint8 ngram_model_s::writable

Are word strings writable?

Definition at line 63 of file ngram_model_internal.h.

Referenced by ngram_model_add_word(), ngram_model_casefold(), ngram_model_free(), and ngram_model_set_map_words().


The documentation for this struct was generated from the following file: