diff options
Diffstat (limited to 'scripts/training/phrase-extract.7/Lattice.h')
-rw-r--r-- | scripts/training/phrase-extract.7/Lattice.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/scripts/training/phrase-extract.7/Lattice.h b/scripts/training/phrase-extract.7/Lattice.h new file mode 100644 index 000000000..c88aa0844 --- /dev/null +++ b/scripts/training/phrase-extract.7/Lattice.h @@ -0,0 +1,47 @@ +#pragma once +/* + * Lattice.h + * extract + * + * Created by Hieu Hoang on 18/07/2010. + * Copyright 2010 __MyCompanyName__. All rights reserved. + * + */ +#include <iostream> +#include <vector> +#include "RuleCollection.h" + +class Global; +class LatticeNode; +class Tunnel; +class TunnelCollection; +class SentenceAlignment; + +typedef std::vector<LatticeNode*> Stack; + +class Lattice +{ + friend std::ostream& operator<<(std::ostream&, const Lattice&); + + std::vector<Stack> m_stacks; + RuleCollection m_rules; + + Stack &GetStack(size_t endPos); + + void CreateArcsUsing1Hole(const Tunnel &tunnel, const SentenceAlignment &sentence, const Global &global); + +public: + Lattice(size_t sourceSize); + ~Lattice(); + + void CreateArcs(size_t startPos, const TunnelCollection &tunnelColl, const SentenceAlignment &sentence, const Global &global); + void CreateRules(size_t startPos, const SentenceAlignment &sentence, const Global &global); + + const Stack &GetStack(size_t startPos) const; + const RuleCollection &GetRules() const + { return m_rules; } + + Stack GetNonTermNode(const Range &sourceRange) const; + +}; + |