2014-12-02 20:10:20 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <ostream>
|
|
|
|
#include <set>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "ExtractionPhrasePair.h"
|
2014-12-07 17:27:51 +03:00
|
|
|
#include "OutputFileStream.h"
|
2014-12-02 20:10:20 +03:00
|
|
|
|
2015-06-04 18:54:31 +03:00
|
|
|
#include "syntax-common/tool.h"
|
|
|
|
|
2014-12-02 20:10:20 +03:00
|
|
|
#include "LexicalTable.h"
|
|
|
|
#include "Options.h"
|
|
|
|
#include "RuleSymbol.h"
|
|
|
|
#include "TokenizedRuleHalf.h"
|
|
|
|
#include "Vocabulary.h"
|
|
|
|
|
2014-12-07 17:27:51 +03:00
|
|
|
namespace MosesTraining
|
|
|
|
{
|
|
|
|
namespace Syntax
|
2014-12-02 20:10:20 +03:00
|
|
|
{
|
|
|
|
namespace ScoreStsg
|
|
|
|
{
|
|
|
|
|
|
|
|
class RuleGroup;
|
|
|
|
class RuleTableWriter;
|
|
|
|
|
2015-06-04 18:54:31 +03:00
|
|
|
class ScoreStsg : public Tool
|
2014-12-02 20:10:20 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ScoreStsg();
|
|
|
|
|
2015-06-04 18:54:31 +03:00
|
|
|
virtual int Main(int argc, char *argv[]);
|
2014-12-02 20:10:20 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
static const int kCountOfCountsMax;
|
|
|
|
|
|
|
|
double ComputeLexProb(const std::vector<RuleSymbol> &,
|
|
|
|
const std::vector<RuleSymbol> &,
|
2014-12-07 17:27:51 +03:00
|
|
|
const ALIGNMENT &);
|
2014-12-02 20:10:20 +03:00
|
|
|
|
|
|
|
void ParseAlignmentString(const std::string &, int,
|
2014-12-07 17:27:51 +03:00
|
|
|
ALIGNMENT &);
|
2014-12-02 20:10:20 +03:00
|
|
|
|
|
|
|
void ProcessOptions(int, char *[], Options &) const;
|
|
|
|
|
|
|
|
void ProcessRuleGroup(const RuleGroup &, RuleTableWriter &);
|
|
|
|
|
|
|
|
void ProcessRuleGroupOrDie(const RuleGroup &, RuleTableWriter &,
|
|
|
|
std::size_t, std::size_t);
|
|
|
|
|
|
|
|
void TokenizeRuleHalf(const std::string &, TokenizedRuleHalf &);
|
|
|
|
|
|
|
|
Options m_options;
|
|
|
|
Vocabulary m_srcVocab;
|
|
|
|
Vocabulary m_tgtVocab;
|
|
|
|
LexicalTable m_lexTable;
|
|
|
|
std::vector<int> m_countOfCounts;
|
|
|
|
int m_totalDistinct;
|
|
|
|
TokenizedRuleHalf m_sourceHalf;
|
|
|
|
TokenizedRuleHalf m_targetHalf;
|
2014-12-07 17:27:51 +03:00
|
|
|
ALIGNMENT m_tgtToSrc;
|
2014-12-02 20:10:20 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ScoreStsg
|
2014-12-07 17:27:51 +03:00
|
|
|
} // namespace Syntax
|
|
|
|
} // namespace MosesTraining
|