ZGen  0.2.0
a linearization system for natural language.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
instance.h
Go to the documentation of this file.
1 #ifndef __ZGEN_TYPES_INSTANCE_H__
2 #define __ZGEN_TYPES_INSTANCE_H__
3 
4 #include <iostream>
5 #include <vector>
6 #include <string>
7 
8 namespace ZGen {
9 
10 // Type define
11 typedef int word_t;
12 typedef int postag_t;
13 typedef int deprel_t;
14 typedef std::vector<word_t> sentence_t;
15 
16 
17 // The struct for dependency parse
19  typedef std::pair<int, int> range_t;
20 
21  std::vector<word_t> forms;
22  std::vector<postag_t> postags;
24  std::vector<int> heads;
25  std::vector<deprel_t> deprels;
26  std::vector<word_t> words;
27  std::vector<range_t> phrases;
28  std::vector<bool> is_phrases;
29  std::vector<std::string> extras;
30 
31  void clear();
32 
33  void push_back(const word_t & form,
34  const postag_t & postag,
35  const int head,
36  const deprel_t & deprel);
37 
38  void push_back(const word_t& form,
39  const postag_t& postag,
40  const int head,
41  const deprel_t& deprel,
42  const std::string& extra);
43 
44  void push_back(const word_t & form,
45  const postag_t & postag,
46  const int head,
47  const deprel_t & deprel,
48  const std::vector<word_t> & extended_words,
49  const range_t & phrase,
50  bool is_phrase);
51 
52  void push_back(const word_t& form,
53  const postag_t& postag,
54  const int head,
55  const deprel_t& deprel,
56  const std::vector<word_t>& extended_words,
57  const range_t& phrase,
58  bool is_phrase,
59  const std::string& extra);
60 
61  size_t size() const;
62 
63  word_t form(int index) const;
64 
65  postag_t postag(int index) const;
66 
67  friend std::ostream & operator << (std::ostream & os, const DependencyParse & d);
68 };
69 
72 
73 }
74 
75 #endif // end for __SR_INSTANCE_H__
postag_t postag(int index) const
Definition: instance.cc:78
void clear()
For extra.
Definition: instance.cc:7
friend std::ostream & operator<<(std::ostream &os, const DependencyParse &d)
Definition: instance.cc:87
int word_t
Definition: instance.h:11
std::pair< int, int > range_t
Definition: instance.h:19
std::vector< deprel_t > deprels
The heads.
Definition: instance.h:25
Definition: instance.h:18
DependencyParse unordered_dependency_t
Definition: instance.h:71
DependencyParse dependency_t
Definition: instance.h:70
void push_back(const word_t &form, const postag_t &postag, const int head, const deprel_t &deprel)
Definition: instance.cc:18
std::vector< word_t > sentence_t
Definition: instance.h:14
std::vector< std::string > extras
Record whether ith item is phrase.
Definition: instance.h:29
std::vector< word_t > words
The dependency relation.
Definition: instance.h:26
std::vector< word_t > forms
Definition: instance.h:21
std::vector< bool > is_phrases
Definition: instance.h:28
size_t size() const
Definition: instance.cc:83
int deprel_t
Definition: instance.h:13
int postag_t
Definition: instance.h:12
word_t form(int index) const
Definition: instance.cc:73
std::vector< int > heads
The postags.
Definition: instance.h:24
std::vector< range_t > phrases
Definition: instance.h:27
std::vector< postag_t > postags
Definition: instance.h:23