1 /*  phonetic.c - generic replacement aglogithms for phonetic transformation
2     Copyright (C) 2000 Bj�rn Jacke
3 
4     This library is free software; you can redistribute it and/or
5     modify it under the terms of the GNU Lesser General Public
6     License version 2.1 as published by the Free Software Foundation;
7 
8     This library is distributed in the hope that it will be useful,
9     but WITHOUT ANY WARRANTY; without even the implied warranty of
10     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11     Lesser General Public License for more details.
12 
13     You should have received a copy of the GNU Lesser General Public
14     License along with this library; if not, write to the Free Software
15     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16 
17     Bj�rn Jacke may be reached by email at bjoern.jacke@gmx.de
18 */
19 
20 #ifndef ASPELLER_PHONET__HPP
21 #define ASPELLER_PHONET__HPP
22 
23 #include "string.hpp"
24 #include "posib_err.hpp"
25 
26 using namespace acommon;
27 
28 namespace acommon {struct Conv;}
29 
30 namespace aspeller {
31 
32   class Language;
33 
34   struct PhonetParms {
35     String version;
36 
37     bool followup;
38     bool collapse_result;
39 
40     bool remove_accents;
41 
42     static const char * const rules_end;
43     const char * * rules;
44 
45     const Language * lang;
46 
47     char to_clean[256];
48 
49     static const int hash_size = 256;
50     int hash[hash_size];
51 
~PhonetParmsaspeller::PhonetParms52     virtual ~PhonetParms() {}
53   };
54 
55   int phonet (const char * inword, char * target,
56               int len,
57 	      const PhonetParms & parms);
58 
59 #if 0
60   void dump_phonet_rules(std::ostream & out, const PhonetParms & parms);
61   // the istream must be seekable
62 #endif
63 
64   PosibErr<PhonetParms *> new_phonet(const String & file,
65                                      Conv & iconv,
66                                      const Language * lang);
67 
68 }
69 
70 #endif
71