wordrec/badwords.h File Reference

#include <stdio.h>

Go to the source code of this file.

Functions


Function Documentation

void PrintBadWords ( FILE *  File  ) 

Prints the bad words stored in BadWords to file ordered by certainty (worst certainty first).

Parameters:
File Open text file to print bad words to
Note:
Globals: BadWords Heap that bad words are stored in
Returns:
none
Note:
Exceptions: none
Date:
Thu Apr 25 08:57:08 1991, DSJ, Created.

Definition at line 59 of file badwords.cpp.

References BadWords, c_free_string(), HEAPENTRY::Data, EMPTY, GetTopOfHeap(), HEAPENTRY::Key, and NULL.

Referenced by dj_statistics().

00059                                { 
00060   HEAPENTRY NextWord;
00061 
00062   if (BadWords == NULL)
00063     return;
00064 
00065   fprintf (File, "\n");
00066   fprintf (File, "Bad Word         Certainty\n");
00067   fprintf (File, "---------------- ---------\n");
00068   while (GetTopOfHeap (BadWords, &NextWord) != EMPTY) {
00069     fprintf (File, "%16s %6.2f\n", (const char *) NextWord.Data,
00070       NextWord.Key);
00071     c_free_string ((char *) NextWord.Data);
00072   }
00073   fprintf (File, "\n");
00074 
00075 }                                /* PrintBadWords */

void SaveBadWord ( const char *  Word,
FLOAT32  Certainty 
)

Saves all words flagged as bad in a heap with the worst word on the top of the heap.

Parameters:
Word bad word to be saved
Certainty certainty of word
Note:
Globals: BadWords heap to keep bad words in
Returns:
none
The contents of this heap can be printed to a file by calling PrintBadWords (File).
Note:
Exceptions: none
Date:
Thu Apr 25 08:41:00 1991, DSJ, Created.

Definition at line 93 of file badwords.cpp.

References assert(), BadWords, c_alloc_string(), HEAPENTRY::Data, HeapFull, HeapStore(), InitHeap, HEAPENTRY::Key, MakeHeap(), MAX_NUM_BAD_WERDS, and NULL.

Referenced by classify_word_pass2().

00093                                                       { 
00094   HEAPENTRY NewWord;
00095 
00096   assert (Word != NULL);
00097 
00098   if (BadWords == NULL) {
00099     BadWords = MakeHeap (MAX_NUM_BAD_WERDS);
00100     InitHeap(BadWords); 
00101   } else if (HeapFull(BadWords)) {
00102     return;
00103   }
00104 
00105   NewWord.Key = Certainty;
00106   NewWord.Data = c_alloc_string (strlen (Word) + 1);
00107   strcpy ((char *) NewWord.Data, Word);
00108   HeapStore(BadWords, &NewWord); 
00109 
00110 }                                /* SaveBadWord */


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