Main Page   Compound List   File List   Compound Members   File Members  

num_of_types.c

Go to the documentation of this file.
00001 
00002 /*=====================================================================
00003                 =======   COPYRIGHT NOTICE   =======
00004 Copyright (C) 1996, Carnegie Mellon University, Cambridge University,
00005 Ronald Rosenfeld and Philip Clarkson.
00006 
00007 All rights reserved.
00008 
00009 This software is made available for research purposes only.  It may be
00010 redistributed freely for this purpose, in full or in part, provided
00011 that this entire copyright notice is included on any copies of this
00012 software and applications and derivations thereof.
00013 
00014 This software is provided on an "as is" basis, without warranty of any
00015 kind, either expressed or implied, as to any matter including, but not
00016 limited to warranty of fitness of purpose, or merchantability, or
00017 results obtained from use of this software.
00018 ======================================================================*/
00019 
00020 
00021 #include "idngram2lm.h"
00022 
00023 unsigned short num_of_types(int k,
00024                             int ind,
00025                             ng_t *ng) {
00026   
00027   int start;
00028   int end;
00029 
00030   start = get_full_index(ng->ind[k][ind],
00031                          ng->ptr_table[k],
00032                          ng->ptr_table_size[k],
00033                          ind);
00034 
00035   if (k>0) {
00036 
00037     if (ind < (ng->num_kgrams[k]-1)) {
00038       
00039       end = get_full_index(ng->ind[k][ind+1],
00040                            ng->ptr_table[k],
00041                            ng->ptr_table_size[k],
00042                            ind+1);
00043     }
00044   
00045     else {
00046       
00047       end = ng->num_kgrams[k+1];
00048       
00049     }
00050 
00051   }
00052   else {
00053     if (ind < ng->vocab_size) {
00054       end = get_full_index(ng->ind[k][ind+1],
00055                            ng->ptr_table[k],
00056                            ng->ptr_table_size[k],
00057                            ind+1);
00058     }
00059   
00060     else {
00061       
00062       end = ng->num_kgrams[k+1];
00063       
00064     }
00065   }
00066 
00067   return(end-start);
00068 
00069 }

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