1 #ifndef __DICTIONARY_H__ // -*- tab-width: 2 mode: c++ -*-
2 #define __DICTIONARY_H__
10 #include <libsrilm/Vocab.h>
11 #include <libsrilm/Ngram.h>
14 #define sarch get_sarch()
16 namespace Dictionary {
19 typedef VocabIndex strid
; // for easy migration
20 #ifndef __MYSTRING_H__
26 strid cid
; // case-insensitive comparision
36 StringArchive():rest(NULL
),blocked(false) {}
37 void set_blocked(bool _blocked
);
38 Vocab
& get_dict() { return dict
; }
41 strid
operator[] (VocabString s
);
42 strid
operator[] (const std::string
&s
) { return (*this)[s
.c_str()]; }
43 VocabString
operator[] (strid i
);
44 bool in_dict(VocabString s
);
45 bool in_dict(const std::string
&s
) { return in_dict(s
.c_str()); }
46 bool in_dict(strid i
) { return i
< dict
.numWords(); }
51 //strpair make_strpair(strid id);
53 int viet_toupper(int ch
);
54 int viet_tolower(int ch
);
55 bool viet_isupper(int ch
);
56 bool viet_islower(int ch
);
57 bool viet_isalpha(int ch
);
58 bool viet_isdigit (int ch
);
59 bool viet_isxdigit(int ch
);
60 bool viet_isspace(int ch
);
61 bool viet_ispunct(int ch
);
65 bool is_syllable_exist(strid
);
66 bool is_syllable_exist(const std::string
&syll
);
67 float get_syllable(const std::string
&syll
);
68 bool is_word_exist(const std::string
&word
);
69 float get_word(const std::string
&word
);
73 #define PROPER_NAME_ID 2
80 StringArchive
& get_sarch();
81 const std::map
<strid
,strid_string
>& get_pnames();
86 inline bool is_syllable_exist(const std::string
&syll
) {
87 return is_syllable_exist(get_sarch()[syll
]);