Download tools/mosesdecoder/moses/Syntax/T2S/HyperTree.h from Quagmire1/wiki-cased: direct link, hf CLI and curl.
- Browser
- Download file 1.76 kB
-
https://huggingface.co/Quagmire1/wiki-cased/resolve/main/tools/mosesdecoder/moses/Syntax/T2S/HyperTree.h
- Command line
-
hf download hf://Quagmire1/wiki-cased/tools/mosesdecoder/moses/Syntax/T2S/HyperTree.h
-
curl -L -o HyperTree.h https://huggingface.co/Quagmire1/wiki-cased/resolve/main/tools/mosesdecoder/moses/Syntax/T2S/HyperTree.h
1.76 kB
| namespace Moses | |
| { | |
| namespace Syntax | |
| { | |
| namespace T2S | |
| { | |
| class HyperTree: public RuleTable | |
| { | |
| public: | |
| class Node | |
| { | |
| public: | |
| typedef boost::unordered_map<std::vector<Factor*>, Node> Map; | |
| bool IsLeaf() const { | |
| return m_map.empty(); | |
| } | |
| bool HasRules() const { | |
| return !m_targetPhraseCollection.IsEmpty(); | |
| } | |
| void Prune(std::size_t tableLimit); | |
| void Sort(std::size_t tableLimit); | |
| Node *GetOrCreateChild(const HyperPath::NodeSeq &); | |
| const Node *GetChild(const HyperPath::NodeSeq &) const; | |
| const TargetPhraseCollection::shared_ptr GetTargetPhraseCollection() const | |
| return m_targetPhraseCollection; | |
| } | |
| TargetPhraseCollection::shared_ptr GetTargetPhraseCollection() | |
| return m_targetPhraseCollection; | |
| } | |
| const Map &GetMap() const | |
| { | |
| return m_map; | |
| } | |
| private: | |
| Map m_map; | |
| TargetPhraseCollection m_targetPhraseCollection; | |
| }; | |
| HyperTree(const RuleTableFF *ff) : RuleTable(ff) {} | |
| const Node &GetRootNode() const | |
| { | |
| return m_root; | |
| } | |
| private: | |
| friend class RuleTrieCreator; | |
| TargetPhraseCollection::shared_ptr GetOrCreateTargetPhraseCollection( | |
| const Word &sourceLHS, const Phrase &sourceRHS); | |
| Node &GetOrCreateNode(const Phrase &sourceRHS); | |
| void SortAndPrune(std::size_t); | |
| Node m_root; | |
| }; | |
| } // namespace T2S | |
| } // namespace Syntax | |
| } // namespace Moses | |