dict/hyphen.h File Reference

#include "choices.h"

Go to the source code of this file.

Defines

Functions

Variables


Define Documentation

 
#define hyphen_base_size (  ) 

Value:

((! is_last_word () && hyphen_string) ?  \
   (strlen (hyphen_string))             :  \
   (0))                                    \
Size of the base word (the part on the line before) of a hyphenated coumpound word.

Definition at line 76 of file hyphen.h.

Referenced by append_next_choice(), and dawg_permute().

#define hyphen_tail ( word   )     (& word [hyphen_base_size()]) \

Return the a pointer to the part of the word that was not on the previous line.

This routine is used for words that were split between lines and hyphenated.

Definition at line 88 of file hyphen.h.

Referenced by append_next_choice().

 
#define is_last_word (  )     (last_word_on_line)

Test the flag that indicated that this is the last word on a line.

Definition at line 69 of file hyphen.h.

Referenced by dawg_permute_and_select().

 
#define reset_hyphen_word (  ) 

Value:

if (last_word_on_line == FALSE) {              \
   if (hyphen_string) strfree (hyphen_string); \
   hyphen_string = NULL;                       \
   hyphen_rating = MAX_FLOAT32;                   \
   hyphen_state = 0;                           \
}                                              \
Erase the hyphenation word that my have been stored at this location.

Definition at line 51 of file hyphen.h.

Referenced by cc_recog().

 
#define reset_last_word (  )     last_word_on_line = FALSE

Reset the flag that indicated that this is the last word on a line.

Definition at line 63 of file hyphen.h.

 
#define set_last_word (  )     last_word_on_line = TRUE

Set the flag that indicated that this is the last word on a line.

Definition at line 45 of file hyphen.h.


Function Documentation

void set_hyphen_word ( char *  word,
float  rating,
int  state 
)

If this hyphenated word choice is better than the last one then add it as the new word choice.

This string can be used on the next line to permute the other half of the word.

Definition at line 46 of file hyphen.cpp.

References cprintf(), display_ratings, hyphen_rating, hyphen_state, hyphen_string, strfree, and strsave.

Referenced by append_next_choice().

00046                                                           { 
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 }


Variable Documentation

float hyphen_rating

Used only in hyphen.cpp

Definition at line 34 of file hyphen.cpp.

Referenced by set_hyphen_word().

int hyphen_state

Used in hyphen.cpp & permdawg.cpp

Definition at line 35 of file hyphen.cpp.

Referenced by dawg_permute_and_select(), and set_hyphen_word().

char* hyphen_string

Used in hyphen.cpp & permdawg.cpp

Definition at line 33 of file hyphen.cpp.

Referenced by dawg_permute_and_select(), permute_words(), and set_hyphen_word().

int last_word_on_line

Note:
File: hyphen.cpp (Formerly hyphen.c)
Deals with detection of hyphens ('-')
Author:
Mark Seaman, OCR Technology
Date:
Oct 16 14:37:00 1987 Mar 14 11:09:43 1991 (Mark Seaman) marks
 * (c) Copyright 1987, Hewlett-Packard Company.
 ** Licensed under the Apache License, Version 2.0 (the "License");
 ** you may not use this file except in compliance with the License.
 ** You may obtain a copy of the License at
 ** http://www.apache.org/licenses/LICENSE-2.0
 ** Unless required by applicable law or agreed to in writing, software
 ** distributed under the License is distributed on an "AS IS" BASIS,
 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ** See the License for the specific language governing permissions and
 ** limitations under the License.

Definition at line 32 of file hyphen.cpp.

Referenced by recog_word_recursive().


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