00001 #pragma once
00002
00003 #include <string>
00004 #include <utility>
00005 #include <vector>
00006
00007 #include "util/string_piece.hh"
00008
00009 namespace MosesTraining
00010 {
00011 namespace Syntax
00012 {
00013 namespace ScoreStsg
00014 {
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 class RuleGroup
00025 {
00026 public:
00027
00028
00029
00030 struct DistinctRule {
00031 std::string target;
00032 std::string ntAlign;
00033 std::vector<std::pair<std::string, int> > alignments;
00034 int count;
00035 double treeScore;
00036 };
00037
00038 typedef std::vector<DistinctRule>::const_iterator ConstIterator;
00039
00040
00041 ConstIterator Begin() const {
00042 return m_distinctRules.begin();
00043 }
00044 ConstIterator End() const {
00045 return m_distinctRules.end();
00046 }
00047
00048
00049 const std::string &GetSource() const {
00050 return m_source;
00051 }
00052
00053
00054 int GetSize() const {
00055 return m_distinctRules.size();
00056 }
00057
00058
00059 int GetTotalCount() const {
00060 return m_totalCount;
00061 }
00062
00063
00064
00065
00066 void SetNewSource(const StringPiece &source);
00067
00068
00069
00070
00071 void AddRule(const StringPiece &target, const StringPiece &ntAlign,
00072 const StringPiece &fullAlign, int count, double treeScore);
00073
00074 private:
00075 std::string m_source;
00076 std::vector<DistinctRule> m_distinctRules;
00077 int m_totalCount;
00078 };
00079
00080 }
00081 }
00082 }