Main Page   Compound List   File List   Compound Members   File Members  

idngram2lm.h File Reference

Function prototypes for idngram2lm. More...

#include "ngram.h"

Go to the source code of this file.

Functions

unsigned short num_of_types (int k, int ind, ng_t *ng)
int get_ngram (FILE *id_ngram_fp, ngram *ng, flag is_ascii)
void calc_mem_req (ng_t *ng, flag is_ascii)
void write_arpa_lm (ng_t *ng, int verbosity)
void write_bin_lm (ng_t *ng, int verbosity)
unsigned short new_index (int full_index, int *ind_table, unsigned short *ind_table_size, int position_in_list)
int get_full_index (unsigned short short_index, int *ind_table, int ind_table_size, int position_in_list)
void compute_gt_discount (int n, int *freq_of_freq, int fof_size, unsigned short *disc_range, int cutoff, int verbosity, disc_val_t **discounted_values)
int lookup_index_of (int *lookup_table, int lookup_table_size, int intintval)
void compute_unigram (ng_t *ng, int verbosity)
void compute_back_off (ng_t *ng, int n, int verbosity)
void bo_ng_prob (int context_length, id__t *sought_ngram, ng_t *ng, int verbosity, double *p_prob, int *bo_case)
void increment_context (ng_t *ng, int k, int verbosity)
unsigned short short_alpha (double long_alpha, double *alpha_array, unsigned short *size_of_alpha_array, int elements_in_range, double min_range, double max_range)
double double_alpha (unsigned short short_alpha, double *alpha_array, int size_of_alpha_array, int elements_in_range, double min_range, double max_range)
void guess_mem (int total_mem, int middle_size, int end_size, int n, table_size_t *table_sizes, int verbosity)
void read_voc (char *filename, int verbosity, sih_t *p_vocab_ht, char ***p_vocab, unsigned short *p_vocab_size)
void store_count (flag four_byte_counts, int *count_table, int count_table_size, unsigned short *short_counts, int *long_counts, int position, int count)
int return_count (flag four_byte_counts, int *count_table, unsigned short *short_counts, int *long_counts, int position)


Detailed Description

Function prototypes for idngram2lm.

Definition in file idngram2lm.h.


Function Documentation

void bo_ng_prob int    context_length,
id__t   sought_ngram,
ng_t   ng,
int    verbosity,
double *    p_prob,
int *    bo_case
 

Definition at line 33 of file bo_ng_prob.c.

References ng_t::abs_disc_const, ABSOLUTE, ng_t::alpha_array, ng_t::bo_weight, ng_t::bo_weight4, ng_t::count, ng_t::count4, ng_t::count_table, ng_t::disc_range, ng_t::discounting_method, double_alpha(), flag, ng_t::four_byte_alphas, ng_t::four_byte_counts, fprintf(), free(), get_full_index(), GOOD_TURING, ng_t::gt_disc_ratio, i, ng_t::ind, ng_t::lin_disc_ratio, LINEAR, ng_t::marg_counts, ng_t::marg_counts4, ng_t::max_alpha, ng_t::min_alpha, ng_t::num_kgrams, num_of_types(), ng_t::out_of_range_alphas, pc_message(), ng_t::ptr_table, ng_t::ptr_table_size, return_count(), rr_malloc(), ng_t::size_of_alpha_array, ng_t::uni_probs, verbosity, ng_t::vocab_size, WITTEN_BELL, and ng_t::word_id.

Referenced by calc_prob_of(), and compute_back_off().

void calc_mem_req ng_t   ng,
flag    is_ascii
 

Definition at line 36 of file calc_mem_req.c.

References ngram::count, count_t, ng_t::cutoffs, flag, get_ngram(), i, ngram::id_array, ng_t::id_gram_filename, ng_t::id_gram_fp, j, ngram::n, ng_t::n, rr_calloc(), rr_feof(), rr_iclose(), rr_iopen(), rr_malloc(), and ng_t::table_sizes.

Referenced by main().

void compute_back_off ng_t   ng,
int    n,
int    verbosity
 

Definition at line 32 of file compute_back_off.c.

References ng_t::abs_disc_const, ABSOLUTE, ng_t::alpha_array, bo_ng_prob(), ng_t::bo_weight, ng_t::bo_weight4, ng_t::count, ng_t::count4, ng_t::count_table, current_pos, ng_t::disc_range, ng_t::discounting_method, end_pos, ng_t::first_id, ng_t::four_byte_alphas, ng_t::four_byte_counts, free(), get_full_index(), GOOD_TURING, ng_t::gt_disc_ratio, i, ng_t::ind, ng_t::lin_disc_ratio, LINEAR, ng_t::marg_counts, ng_t::marg_counts4, ng_t::max_alpha, ng_t::min_alpha, ng_t::num_kgrams, num_of_types(), ng_t::out_of_range_alphas, pc_message(), ng_t::ptr_table, ng_t::ptr_table_size, return_count(), rr_calloc(), short_alpha(), ng_t::size_of_alpha_array, verbosity, ng_t::vocab, ng_t::vocab_size, WITTEN_BELL, and ng_t::word_id.

Referenced by main().

void compute_gt_discount int    n,
int *    freq_of_freq,
int    fof_size,
unsigned short *    disc_range,
int    cutoff,
int    verbosity,
disc_val_t **    discounted_values
 

Definition at line 31 of file compute_discount.c.

References disc_val_t, flag, MIN, pc_message(), rr_calloc(), and verbosity.

Referenced by main().

void compute_unigram ng_t   ng,
int    verbosity
 

Definition at line 67 of file compute_unigram.c.

References ng_t::abs_disc_const, ABSOLUTE, CLOSED_VOCAB, ng_t::context_cue, ng_t::count, ng_t::count4, ng_t::count_table, ng_t::disc_range, ng_t::discounting_method, ng_t::first_id, ng_t::four_byte_counts, fprintf(), ng_t::freq_of_freq, GOOD_TURING, ng_t::gt_disc_ratio, i, ng_t::lin_disc_ratio, LINEAR, ng_t::n_unigrams, ng_t::no_of_ccs, ng_t::oov_fraction, OPEN_VOCAB_2, pc_message(), quit(), return_count(), ng_t::uni_log_probs, ng_t::uni_probs, verbosity, ng_t::vocab_size, ng_t::vocab_type, WITTEN_BELL, and ng_t::zeroton_fraction.

Referenced by main().

double double_alpha unsigned short    short_alpha,
double *    alpha_array,
int    size_of_alpha_array,
int    elements_in_range,
double    min_range,
double    max_range
 

Definition at line 95 of file two_byte_alphas.c.

References quit(), and short_alpha().

Referenced by bo_ng_prob(), and for().

int get_full_index unsigned short    short_index,
int *    ind_table,
int    ind_table_size,
int    position_in_list
 

int get_ngram FILE *    id_ngram_fp,
ngram   ng,
flag    is_ascii
 

Definition at line 31 of file get_ngram.c.

void guess_mem int    total_mem,
int    middle_size,
int    end_size,
int    n,
table_size_t   table_sizes,
int    verbosity
 

Definition at line 35 of file guess_mem.c.

References i, pc_message(), rr_malloc(), table_size_t, and verbosity.

Referenced by main().

void increment_context ng_t   ng,
int    k,
int    verbosity
 

Definition at line 27 of file increment_context.c.

References ng_t::count, ng_t::count4, ng_t::count_table, ng_t::count_table_size, current_pos, ng_t::disc_range, end_pos, ng_t::first_id, flag, ng_t::four_byte_counts, free(), get_full_index(), ng_t::ind, j, ng_t::marg_counts, ng_t::marg_counts4, ng_t::num_kgrams, ng_t::ptr_table, ng_t::ptr_table_size, return_count(), rr_calloc(), store_count(), verbosity, and ng_t::vocab_size.

Referenced by main().

int lookup_index_of int *    lookup_table,
int    lookup_table_size,
int    intintval
 

unsigned short new_index int    full_index,
int *    ind_table,
unsigned short *    ind_table_size,
int    position_in_list
 

Definition at line 51 of file short_indices.c.

References KEY.

Referenced by load_arpa_lm(), and main().

unsigned short num_of_types int    k,
int    ind,
ng_t   ng
 

Definition at line 23 of file num_of_types.c.

References get_full_index(), ng_t::ind, ng_t::num_kgrams, ng_t::ptr_table, ng_t::ptr_table_size, and ng_t::vocab_size.

Referenced by bo_ng_prob(), and compute_back_off().

void read_voc char *    filename,
int    verbosity,
sih_t   p_vocab_ht,
char ***    p_vocab,
unsigned short *    p_vocab_size
 

Definition at line 34 of file read_voc.c.

References get_vocab_from_vocab_ht(), sih_t::nentries, read_wlist_into_array(), read_wlist_into_siht(), rr_iclose(), rr_iopen(), salloc(), sih_val_read_from_file(), and verbosity.

Referenced by main().

int return_count flag    four_byte_counts,
int *    count_table,
unsigned short *    short_counts,
int *    long_counts,
int    position
 

Definition at line 48 of file counts.c.

References flag.

Referenced by bo_ng_prob(), compute_back_off(), compute_unigram(), increment_context(), and main().

unsigned short short_alpha double    long_alpha,
double *    alpha_array,
unsigned short *    size_of_alpha_array,
int    elements_in_range,
double    min_range,
double    max_range
 

Definition at line 46 of file two_byte_alphas.c.

References i, and quit().

Referenced by compute_back_off(), and double_alpha().

void store_count flag    four_byte_counts,
int *    count_table,
int    count_table_size,
unsigned short *    short_counts,
int *    long_counts,
int    position,
int    count
 

Definition at line 30 of file counts.c.

References flag, and lookup_index_of().

Referenced by increment_context(), and main().

void write_arpa_lm ng_t   ng,
int    verbosity
 

Definition at line 32 of file write_lms.c.

References current_pos, end_pos, and verbosity.

Referenced by main().

void write_bin_lm ng_t   ng,
int    verbosity
 

Definition at line 439 of file write_lms.c.

References ng_t::abs_disc_const, ABSOLUTE, ng_t::alpha_array, BBO_FILE_VERSION, ng_t::bin_filename, ng_t::bin_fp, ng_t::bo_weight, ng_t::bo_weight4, bo_weight_t, ng_t::context_cue, ng_t::count, ng_t::count4, count_ind_t, count_t, ng_t::count_table, ng_t::count_table_size, cutoff_t, ng_t::cutoffs, ng_t::disc_range, disc_val_t, ng_t::discounting_method, ng_t::first_id, flag, ng_t::fof_size, ng_t::four_byte_alphas, ng_t::four_byte_counts, four_byte_t, ng_t::freq_of_freq, GOOD_TURING, ng_t::gt_disc_ratio, i, ng_t::ind, index__t, j, ng_t::lin_disc_ratio, LINEAR, ng_t::marg_counts, ng_t::marg_counts4, ng_t::max_alpha, ng_t::min_alpha, ng_t::n, ng_t::n_unigrams, ng_t::no_of_ccs, ng_t::num_kgrams, ng_t::oov_fraction, ng_t::out_of_range_alphas, pc_message(), ptr_tab_t, ng_t::ptr_table, ng_t::ptr_table_size, rr_fwrite(), rr_oclose(), sih_val_write_to_file(), ng_t::size_of_alpha_array, SWAPHALF, SWAPWORD, ng_t::uni_log_probs, ng_t::uni_probs, uni_probs_t, verbosity, ng_t::version, ng_t::vocab_ht, ng_t::vocab_size, ng_t::vocab_type, WITTEN_BELL, ng_t::word_id, and ng_t::zeroton_fraction.

Referenced by main().


Generated on Tue Dec 21 13:54:47 2004 by doxygen1.2.18