Download tools/mosesdecoder/moses/Syntax/RuleTableFF.cpp from Quagmire1/wiki-cased: direct link, hf CLI and curl.
- Browser
- Download file 2.13 kB
-
https://huggingface.co/Quagmire1/wiki-cased/resolve/main/tools/mosesdecoder/moses/Syntax/RuleTableFF.cpp
- Command line
-
hf download hf://Quagmire1/wiki-cased/tools/mosesdecoder/moses/Syntax/RuleTableFF.cpp
-
curl -L -o RuleTableFF.cpp https://huggingface.co/Quagmire1/wiki-cased/resolve/main/tools/mosesdecoder/moses/Syntax/RuleTableFF.cpp
2.13 kB
| namespace Moses | |
| { | |
| namespace Syntax | |
| { | |
| std::vector<RuleTableFF*> RuleTableFF::s_instances; | |
| RuleTableFF::RuleTableFF(const std::string &line) | |
| : PhraseDictionary(line, true) | |
| { | |
| ReadParameters(); | |
| // caching for memory pt is pointless | |
| m_maxCacheSize = 0; | |
| s_instances.push_back(this); | |
| } | |
| void RuleTableFF::Load(Moses::AllOptions::ptr const& opts) | |
| { | |
| m_options = opts; | |
| SetFeaturesToApply(); | |
| if (opts->search.algo == SyntaxF2S || opts->search.algo == SyntaxT2S) { | |
| F2S::HyperTree *trie = new F2S::HyperTree(this); | |
| F2S::HyperTreeLoader loader; | |
| loader.Load(*opts, m_input, m_output, m_filePath, *this, *trie, m_sourceTerminalSet); | |
| m_table = trie; | |
| } else if (opts->search.algo == SyntaxS2T) { | |
| S2TParsingAlgorithm algorithm = opts->syntax.s2t_parsing_algo; // staticData.GetS2TParsingAlgorithm(); | |
| if (algorithm == RecursiveCYKPlus) { | |
| S2T::RuleTrieCYKPlus *trie = new S2T::RuleTrieCYKPlus(this); | |
| S2T::RuleTrieLoader loader; | |
| loader.Load(*opts,m_input, m_output, m_filePath, *this, *trie); | |
| m_table = trie; | |
| } else if (algorithm == Scope3) { | |
| S2T::RuleTrieScope3 *trie = new S2T::RuleTrieScope3(this); | |
| S2T::RuleTrieLoader loader; | |
| loader.Load(*opts, m_input, m_output, m_filePath, *this, *trie); | |
| m_table = trie; | |
| } else { | |
| UTIL_THROW2("ERROR: unhandled S2T parsing algorithm"); | |
| } | |
| } else if (opts->search.algo == SyntaxT2S_SCFG) { | |
| T2S::RuleTrie *trie = new T2S::RuleTrie(this); | |
| T2S::RuleTrieLoader loader; | |
| loader.Load(*opts, m_input, m_output, m_filePath, *this, *trie); | |
| m_table = trie; | |
| } else { | |
| UTIL_THROW2( | |
| "ERROR: RuleTableFF currently only supports the S2T, T2S, T2S_SCFG, and F2S search algorithms"); | |
| } | |
| } | |
| } // Syntax | |
| } // Moses | |