00001 /* -*-C-*- 00002 ******************************************************************************** 00003 * 00004 * File: context.h (Formerly context.h) 00005 * Description: Context checking functions 00006 * Author: Mark Seaman, OCR Technology 00007 * Created: Thu Feb 15 11:18:24 1990 00008 * Modified: Tue Jul 9 17:00:38 1991 (Mark Seaman) marks@hpgrlt 00009 * Language: C 00010 * Package: N/A 00011 * Status: Experimental (Do Not Distribute) 00012 * 00013 * (c) Copyright 1990, Hewlett-Packard Company. 00014 ** Licensed under the Apache License, Version 2.0 (the "License"); 00015 ** you may not use this file except in compliance with the License. 00016 ** You may obtain a copy of the License at 00017 ** http://www.apache.org/licenses/LICENSE-2.0 00018 ** Unless required by applicable law or agreed to in writing, software 00019 ** distributed under the License is distributed on an "AS IS" BASIS, 00020 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00021 ** See the License for the specific language governing permissions and 00022 ** limitations under the License. 00023 * 00024 ******************************************************************************** 00025 */ 00026 00027 #ifndef CONTEXT_H 00028 #define CONTEXT_H 00029 00030 #include "choices.h" 00031 #include "ratngs.h" 00032 00033 /*---------------------------------------------------------------------- 00034 F u n c t i o n s 00035 ----------------------------------------------------------------------*/ 00036 namespace tesseract { 00037 00038 class Context { 00039 public: 00040 static int case_ok(const WERD_CHOICE &word, const UNICHARSET &unicharset); 00041 }; 00042 } // namespace tesseract 00043 00044 void close_choices(); 00045 00046 void write_choice_line(); 00047 00048 typedef double (*PROBABILITY_IN_CONTEXT_FUNCTION)(const char* context, 00049 int context_bytes, 00050 const char* character, 00051 int character_bytes); 00052 00053 extern PROBABILITY_IN_CONTEXT_FUNCTION probability_in_context; 00054 00055 extern double def_probability_in_context(const char* context, 00056 int context_bytes, 00057 const char* character, 00058 int character_bytes); 00059 00060 /* 00061 #if defined(__STDC__) || defined(__cplusplus) 00062 # define _ARGS(s) s 00063 #else 00064 # define _ARGS(s) () 00065 #endif*/ 00066 00067 /* context.c 00068 void close_choices 00069 _ARGS((void)); 00070 00071 void fix_quotes 00072 _ARGS((char *str)); 00073 00074 int punctuation_ok 00075 _ARGS((char *word)); 00076 00077 int case_ok 00078 _ARGS((char *word)); 00079 00080 void write_choice_line 00081 _ARGS((void)); 00082 00083 #undef _ARGS 00084 */ 00085 #endif