File size: 671 Bytes
158b61b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
#pragma once
#include <vector>
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include "Forest.h"
namespace Moses
{
namespace Syntax
{
namespace F2S
{
class TopologicalSorter
{
public:
void Sort(const Forest &, std::vector<const Forest::Vertex *> &);
private:
typedef boost::unordered_set<const Forest::Vertex *> VertexSet;
void BuildPredSets(const Forest &);
void Visit(const Forest::Vertex &, std::vector<const Forest::Vertex *> &);
boost::unordered_set<const Forest::Vertex *> m_visited;
boost::unordered_map<const Forest::Vertex *, VertexSet> m_predSets;
};
} // namespace F2S
} // namespace Syntax
} // namespace Moses
|