00001 #pragma once
00002
00003 #include <istream>
00004 #include <ostream>
00005 #include <string>
00006 #include <vector>
00007
00008 #include <boost/shared_ptr.hpp>
00009 #include <boost/unordered_map.hpp>
00010
00011 #include "SyntaxTree.h"
00012
00013 #include "syntax-common/numbered_set.h"
00014 #include "syntax-common/tree.h"
00015 #include "syntax-common/tree_fragment_tokenizer.h"
00016
00017 #include "TsgFilter.h"
00018
00019 namespace MosesTraining
00020 {
00021 namespace Syntax
00022 {
00023 namespace FilterRuleTable
00024 {
00025
00026
00027
00028
00029 class TreeTsgFilter : public TsgFilter
00030 {
00031 public:
00032
00033 TreeTsgFilter(const std::vector<boost::shared_ptr<SyntaxTree> > &);
00034
00035 private:
00036
00037 void AddNodesToMap(const IdTree &);
00038
00039
00040 bool MatchFragment(const IdTree &, const std::vector<IdTree *> &);
00041
00042
00043 bool MatchFragment(const IdTree &, const IdTree &);
00044
00045
00046
00047 IdTree *SyntaxTreeToIdTree(const SyntaxTree &);
00048
00049 std::vector<boost::shared_ptr<IdTree> > m_sentences;
00050 std::vector<std::vector<const IdTree *> > m_labelToTree;
00051 };
00052
00053 }
00054 }
00055 }