wordrec/tally.h File Reference

#include <stdio.h>

Go to the source code of this file.

Classes

Defines

Typedefs

Functions


Define Documentation

#define inc_tally_bucket ( t,
 ) 

Value:

(t->count++,                \
   ((i < t->num_buckets) ?    \
   (t->buckets[i]++) :       \
   (t->buckets[t->num_buckets-1]++)))
Increment the bucket count for the chosen bucket.

Definition at line 53 of file tally.h.

Referenced by record_certainty(), and record_search_status().

#define iterate_tally ( t,
 )     for (i=0; i<t->num_buckets; i++)

Iterate through all the buckets in a tally record.

Definition at line 63 of file tally.h.

Referenced by new_tally(), print_tally(), and save_summary().

#define tally_entry ( t,
 )     (t->buckets[i])

Access one of the buckets of a tally record without bounds checking.

Definition at line 70 of file tally.h.

Referenced by new_tally(), print_tally(), and save_summary().


Typedef Documentation

TALLY

Type of _TALLY_, holds probability/histogram.


Function Documentation

TALLY new_tally ( int  num_buckets  ) 

Create a new tally record and initialize it.

Definition at line 34 of file tally.cpp.

References _TALLY_::count, iterate_tally, memalloc(), _TALLY_::num_buckets, and tally_entry.

Referenced by init_metrics(), and reset_width_tally().

00034                                  { 
00035   TALLY t;
00036   int x;
00037 
00038   t = (TALLY) memalloc ((num_buckets + 2) * sizeof (int));
00039   t->count = 0;
00040   t->num_buckets = num_buckets;
00041 
00042   iterate_tally (t, x) tally_entry (t, x) = 0;
00043 
00044   return (t);
00045 }

void print_tally ( FILE *  file,
const char *  string,
TALLY  t 
)

Print the results of a given tally.

Definition at line 52 of file tally.cpp.

References _TALLY_::count, cprintf(), iterate_tally, _TALLY_::num_buckets, and tally_entry.

Referenced by save_summary().

00052                                                           { 
00053   int x;
00054 
00055   cprintf ("%d %s buckets\n", t->num_buckets, string);
00056   cprintf ("%d samples in %s\n", t->count, string);
00057 
00058   iterate_tally (t, x)
00059     cprintf ("   %s [%d] = %d\n", string, x, tally_entry (t, x));
00060   cprintf ("\n");
00061 }


Generated on Wed Feb 28 19:49:29 2007 for Tesseract by  doxygen 1.5.1