mosesdecoder/contrib/other-builds/moses2/SCFG/ActiveChart.cpp

41 lines
810 B
C++
Raw Normal View History

2016-04-20 22:22:57 +03:00
#include <boost/foreach.hpp>
2016-05-01 11:32:49 +03:00
#include <boost/functional/hash_fwd.hpp>
#include "ActiveChart.h"
2016-04-20 18:54:08 +03:00
#include "InputPath.h"
namespace Moses2
{
namespace SCFG
{
2016-05-01 11:32:49 +03:00
size_t hash_value(const SymbolBindElement &obj)
{
size_t ret = (size_t) obj.range;
boost::hash_combine(ret, obj.word);
return ret;
}
////////////////////////////////////////////////////////////////////////////
2016-05-01 10:58:36 +03:00
ActiveChartEntry::ActiveChartEntry(
const SCFG::InputPath &subPhrasePath,
const SCFG::Word &word,
const ActiveChartEntry &prevEntry)
:symbolBinds(prevEntry.symbolBinds)
2016-04-20 18:54:08 +03:00
{
2016-05-01 01:15:07 +03:00
symbolBinds.Add(subPhrasePath.range, word);
2016-04-20 18:54:08 +03:00
}
2016-04-20 22:22:57 +03:00
std::ostream& operator<<(std::ostream &out, const SymbolBind &obj)
{
2016-05-01 11:32:49 +03:00
BOOST_FOREACH(const SymbolBindElement &ele, obj.coll) {
out << "("<< *ele.range << *ele.word << ") ";
2016-04-20 22:22:57 +03:00
}
return out;
}
2016-04-20 18:54:08 +03:00
}
}