ZGen  0.2.0
a linearization system for natural language.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
postag_constrain.h
Go to the documentation of this file.
1 #ifndef __ZGEN_KNOWLEDGE_POSTAG_CONSTRAIN_H__
2 #define __ZGEN_KNOWLEDGE_POSTAG_CONSTRAIN_H__
3 
4 #include <iostream>
5 #include <vector>
6 #include <boost/unordered_map.hpp>
7 #include "settings.h"
8 #include "types/instance.h"
9 
10 namespace ZGen {
11 
12 namespace Knowledge {
13 
15 public:
16  PostagConstrain(const char* postag_dict_path);
17 
24  void get_possible_tags(const char* word,
25  std::vector<postag_t>& possible_tags) const;
26 
33  void get_possible_tags(const word_t word,
34  std::vector<postag_t>& possible_tags) const;
35 
36 private:
44  void init_postag_constraints_from_file(std::istream& ifs);
45 
50  void init_default_postag_constraints();
51 
52  typedef std::bitset<kNumberOfPostags> postag_mask_t;
53  typedef boost::unordered_map<word_t, postag_mask_t> map_t;
54 
55  map_t postag_constraints;
56 };
57 
58 }
59 
60 } // end for namespace
61 
62 #endif // end for __ZGEN_KNOWLEDGE_POSTAG_CONSTRAIN_H__
PostagConstrain(const char *postag_dict_path)
Definition: postag_constrain.cc:20
void get_possible_tags(const char *word, std::vector< postag_t > &possible_tags) const
Definition: postag_constrain.cc:92
int word_t
Definition: instance.h:11
Definition: postag_constrain.h:14