00001 #pragma once 00002 00003 #include <boost/functional/hash.hpp> 00004 00005 #include "moses/Factor.h" 00006 #include "moses/Word.h" 00007 00008 namespace Moses 00009 { 00010 namespace Syntax 00011 { 00012 00013 // Assumes that only the first factor is relevant. i.e. factored decoding will 00014 // *not* work in moses_chart unless this is changed (among other things). 00015 class SymbolHasher 00016 { 00017 public: 00018 std::size_t operator()(const Word &s) const { 00019 const Factor *f = s[0]; 00020 return hash_value(*f); 00021 } 00022 }; 00023 00024 } // namespace Syntax 00025 } // namespace Moses