last changes
[vspell.git] / libvspell / syllable.h
blob024bcabd5572cec0817ec35e0eddd1b47bd46a92
1 #ifndef __SYLLABLE_H__ // -*- tab-width: 2 mode: c++ -*-
2 #define __SYLLABLE_H__
4 #ifndef __DICTIONARY_H__
5 #include "dictionary.h"
6 #endif
8 #ifndef __VECTOR__
9 #include <vector>
10 #endif
12 class Syllable {
13 public:
14 enum diacritics {
15 None = 0,
16 Acute,
17 Grave,
18 Hook,
19 Tilde,
20 Dot
22 enum {
23 First_Consonant,
24 Padding_Vowel,
25 Vowel,
26 Last_Consonant,
27 Diacritic
30 int components[5];
31 std::string scomponents[5];
32 // int first_consonant;
33 // int padding_vowel;
34 // int vowel;
35 // int last_consonant;
36 // diacritics diacritic;
38 Syllable(const char* _first_consonant = NULL,
39 const char* _padding_vowel = NULL,
40 const char* _vowel = NULL,
41 const char* _last_consonant = NULL,
42 int diacritic = -1);
43 Syllable(const Syllable &sy);
45 std::string get_component(int i);
46 bool set_component(int i,const char *s);
49 bool match(const Syllable &sample);
50 void apply(const Syllable &sample,std::vector<Syllable> &output);
51 bool parse(const char *str);
52 void standardize(std::string str);
53 strid to_id() const;
54 strid to_std_id() const;
55 std::string to_str() const;
56 std::string to_std_str() const;
57 friend std::ostream& operator << (std::ostream &os,const Syllable &sy);
58 friend bool operator < (const Syllable &s1,const Syllable &s2);
59 friend bool operator == (const Syllable &s1,const Syllable &s2);
62 //extern char *vowels[];
63 //extern char *first_consonants[];
64 //extern char *last_consonants[];
65 //extern char *padding_vowels[];
66 std::string get_std_syllable(const std::string &str);
67 std::string get_unstd_syllable(const std::string &str);
68 std::string get_lowercased_syllable(const std::string &str);
69 typedef std::vector<Syllable> confusion_set;
70 std::vector<confusion_set>& get_confusion_sets();
72 #endif