dict/hyphen.cpp

Go to the documentation of this file.
00001 
00020 /*----------------------------------------------------------------------
00021               I n c l u d e s
00022 ----------------------------------------------------------------------*/
00023 #include "const.h"
00024 #include "hyphen.h"
00025 #include "tordvars.h"
00026 #include "callcpp.h"
00027 #include <math.h>
00028 
00029 /*----------------------------------------------------------------------
00030               V a r i a b l e s
00031 ----------------------------------------------------------------------*/
00032 int last_word_on_line = 0;
00033 char *hyphen_string = 0;
00034 float hyphen_rating = MAXFLOAT;
00035 int hyphen_state = 0;
00036 
00037 /*----------------------------------------------------------------------
00038               F u n c t i o n s
00039 ---------------------------------------------------------------------*/
00046 void set_hyphen_word(char *word, float rating, int state) { 
00047   int char_index = strlen (word) - 1;
00048 
00049   if (display_ratings)
00050     cprintf ("set hyphen word = %s\n", word);
00051 
00052   if (hyphen_rating > rating && char_index > 0) {
00053     word[char_index] = '\0';
00054 
00055     if (hyphen_string)
00056       strfree(hyphen_string); 
00057     hyphen_string = strsave (word);
00058 
00059     hyphen_state = state;
00060     hyphen_rating = rating;
00061 
00062     word[char_index] = '-';
00063   }
00064 }

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