1 #ifndef __ZGEN_SHIFTREDUCE_TYPES_ACTION_H__
2 #define __ZGEN_SHIFTREDUCE_TYPES_ACTION_H__
8 #include <boost/tuple/tuple.hpp>
9 #include <boost/functional/hash.hpp>
10 #include <boost/archive/text_iarchive.hpp>
11 #include <boost/archive/text_oarchive.hpp>
12 #include <boost/serialization/singleton.hpp>
16 namespace ShiftReduce {
25 Action(
int _prefix,
int _label,
int _word)
29 boost::hash_combine(
seed, _prefix);
30 boost::hash_combine(
seed, _label);
31 boost::hash_combine(
seed, _word);
34 Action(
int _prefix,
int _label,
int _word,
int _index)
40 boost::hash_combine(
seed, _prefix);
41 boost::hash_combine(
seed, _label);
42 boost::hash_combine(
seed, _word);
45 inline std::size_t
hash()
const {
67 return !((*this) == a);
72 template<
class Archive>
78 namespace eg = Engine;
79 os <<
"(" << eg::ActionEngine::get_const_instance().decode(act.
prefix)
83 os << eg::PostagEngine::get_const_instance().decode(act.
label)
85 << eg::WordEngine::get_const_instance().decode(act.
word)
86 <<
", [" << act.
index <<
"]"
89 os << eg::DeprelEngine::get_const_instance().decode(act.
label)
121 #endif // end for __SR_ACTION_HPP__
Action(int _prefix, int _label, int _word)
Definition: action.h:25
int prefix
Definition: action.h:99
std::size_t seed
Definition: action.h:112
Action()
Definition: action.h:20
Action(int _prefix, int _label, int _word, int _index)
Definition: action.h:34
int index
Definition: action.h:109
bool operator==(const Action &a) const
Definition: action.h:59
friend class boost::serialization::access
Definition: action.h:70
std::size_t hash() const
Definition: action.h:45
friend std::ostream & operator<<(std::ostream &os, const Action &act)
Definition: action.h:77
friend std::size_t hash_value(const Action &a)
Definition: action.h:95
void serialize(Archive &ar, const unsigned int)
Definition: action.h:73
Definition: action_alphabet.h:32
bool operator!=(const Action &a) const
Definition: action.h:66
int label
Definition: action.h:102
int word
Definition: action.h:106
Action & operator=(const Action &a)
Definition: action.h:49
Action action_t
Definition: action.h:115