00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00027 #include "ngram.h"
00028 #include "idngram2lm.h"
00029
00030 void store_count(flag four_byte_counts,
00031 int *count_table,
00032 int count_table_size,
00033 unsigned short *short_counts,
00034 int *long_counts,
00035 int position,
00036 int count) {
00037
00038 if (four_byte_counts) {
00039 long_counts[position] = count;
00040 }
00041 else {
00042 short_counts[position] = lookup_index_of(count_table,
00043 count_table_size,
00044 count);
00045 }
00046 }
00047
00048 int return_count(flag four_byte_counts,
00049 int *count_table,
00050 unsigned short *short_counts,
00051 int *long_counts,
00052 int position) {
00053
00054 if (four_byte_counts) {
00055 return(long_counts[position]);
00056 }
00057 else {
00058 return(count_table[short_counts[position]]);
00059 }
00060
00061 }
00062