2014-11-04 16:13:56 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "moses/TranslationModel/PhraseDictionary.h"
|
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
|
|
|
|
class ChartParser;
|
|
|
|
class ChartCellCollectionBase;
|
2015-12-08 02:34:57 +03:00
|
|
|
class AllOptions;
|
2014-11-04 16:13:56 +03:00
|
|
|
namespace Syntax
|
|
|
|
{
|
|
|
|
|
|
|
|
class RuleTable;
|
|
|
|
|
|
|
|
// Feature function for dealing with local rule scores (that come from a
|
|
|
|
// rule table). The scores themselves are stored on TargetPhrase objects
|
|
|
|
// and the decoder accesses them directly, so this object doesn't really do
|
|
|
|
// anything except provide somewhere to store the weights and parameter values.
|
|
|
|
class RuleTableFF : public PhraseDictionary
|
|
|
|
{
|
2015-01-14 14:07:42 +03:00
|
|
|
public:
|
2014-11-04 16:13:56 +03:00
|
|
|
RuleTableFF(const std::string &);
|
|
|
|
|
|
|
|
// FIXME Delete m_table?
|
|
|
|
~RuleTableFF() {}
|
|
|
|
|
2015-12-10 06:17:36 +03:00
|
|
|
void Load(AllOptions::ptr const& opts);
|
2014-11-04 16:13:56 +03:00
|
|
|
|
2015-01-14 14:07:42 +03:00
|
|
|
const RuleTable *GetTable() const {
|
|
|
|
return m_table;
|
|
|
|
}
|
2014-11-04 16:13:56 +03:00
|
|
|
|
2015-01-14 14:07:42 +03:00
|
|
|
static const std::vector<RuleTableFF*> &Instances() {
|
|
|
|
return s_instances;
|
|
|
|
}
|
2014-11-04 16:13:56 +03:00
|
|
|
|
|
|
|
ChartRuleLookupManager *CreateRuleLookupManager(
|
2015-01-14 14:07:42 +03:00
|
|
|
const ChartParser &, const ChartCellCollectionBase &, std::size_t) {
|
2014-11-04 16:13:56 +03:00
|
|
|
assert(false);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-04-13 18:31:58 +03:00
|
|
|
// Get the source terminal vocabulary for this table's grammar (as a set of
|
|
|
|
// factor IDs)
|
|
|
|
const boost::unordered_set<std::size_t> &GetSourceTerminalSet() const {
|
|
|
|
return m_sourceTerminalSet;
|
|
|
|
}
|
|
|
|
|
2015-01-14 14:07:42 +03:00
|
|
|
private:
|
2014-11-04 16:13:56 +03:00
|
|
|
static std::vector<RuleTableFF*> s_instances;
|
|
|
|
|
|
|
|
const RuleTable *m_table;
|
2015-04-13 18:31:58 +03:00
|
|
|
boost::unordered_set<std::size_t> m_sourceTerminalSet;
|
2014-11-04 16:13:56 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // Syntax
|
|
|
|
} // Moses
|