Main Page   Compound List   File List   Compound Members   File Members  

counts.c

Go to the documentation of this file.
00001 /*=====================================================================
00002                 =======   COPYRIGHT NOTICE   =======
00003 Copyright (C) 1997, Carnegie Mellon University, Cambridge University,
00004 Ronald Rosenfeld and Philip Clarkson.
00005 
00006 All rights reserved.
00007 
00008 This software is made available for research purposes only.  It may be
00009 redistributed freely for this purpose, in full or in part, provided
00010 that this entire copyright notice is included on any copies of this
00011 software and applications and derivations thereof.
00012 
00013 This software is provided on an "as is" basis, without warranty of any
00014 kind, either expressed or implied, as to any matter including, but not
00015 limited to warranty of fitness of purpose, or merchantability, or
00016 results obtained from use of this software.
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                  

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