HFST - Helsinki Finite-State Transducer Technology API  version 3.7.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HfstLookupFlagDiacritics.h
1 #ifndef _LOOKUP_FLAG_DIACRITICS_H_
2 #define _LOOKUP_FLAG_DIACRITICS_H_
3 #include <set>
4 #include <map>
5 #include <string>
6 #include <cassert>
7 #include <vector>
8 #include <iostream>
9 #ifdef DEBUG
10 #include <iostream>
11 #endif
12 
13 enum DiacriticOperator
14  {
15  Pop, Nop, Dop, Rop, Cop, Uop
16  };
17 
18 typedef std::map<std::string,DiacriticOperator> DiacriticOperators;
19 typedef std::map<std::string,std::string> DiacriticFeatures;
20 typedef std::map<std::string,std::string> DiacriticValues;
21 typedef std::map<std::string,bool> DiacriticSettingMap;
22 typedef std::map<std::string,std::string> FeatureValues;
23 typedef std::map<std::string,bool> FeaturePolarities;
24 typedef std::vector<std::string> StringVector;
25 class FlagDiacriticTable
26 {
27  static DiacriticOperators diacritic_operators;
28  static DiacriticFeatures diacritic_features;
29  static DiacriticValues diacritic_values;
30  FeatureValues feature_values;
31  FeaturePolarities feature_polarities;
32  static DiacriticSettingMap diacritic_has_value;
33  bool error_flag;
34  static bool is_genuine_diacritic(const std::string &diacritic_string);
35  static void split_diacritic(const std::string &diacritic_string);
36  void set_positive_value(std::string &feature,
37  std::string &value);
38  void set_negative_value(std::string &feature,
39  std::string &value);
40  void disallow(std::string &feature,
41  std::string &value);
42  void disallow(std::string &feature);
43  void require(std::string &feature,
44  std::string &value);
45  void require(std::string &feature);
46  void unify(std::string &feature,
47  std::string &value);
48  void clear(std::string &feature);
49 
50  public:
51  FlagDiacriticTable(void);
52  /*static void define_diacritic(short diacritic_number,
53  const std::string &diacritic_string);
54  void insert_number(short key_number);*/
55  void insert_symbol(const std::string &symbol);
56  void reset(void);
57  bool fails(void);
58  static bool is_diacritic(const std::string &symbol);
59  bool is_valid_string(const StringVector & input_string);
60  StringVector filter_diacritics(const StringVector & input_string);
61 #ifdef DEBUG
62  static void display(short diacritic);
63 #endif
64 };
65 
66 #endif
std::vector< std::string > StringVector
A vector of strings.
Definition: HfstDataTypes.h:88