Download mosesdecoder/phrase-extract/syntax-common/tool.cc from suricodes/hindi-sindhi-docker: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/spaces/suricodes/hindi-sindhi-docker/resolve/main/mosesdecoder/phrase-extract/syntax-common/tool.cc
- Command line
-
hf download hf://spaces/suricodes/hindi-sindhi-docker/mosesdecoder/phrase-extract/syntax-common/tool.cc
-
curl -L -o tool.cc https://huggingface.co/spaces/suricodes/hindi-sindhi-docker/resolve/main/mosesdecoder/phrase-extract/syntax-common/tool.cc
1.47 kB
| namespace MosesTraining { | |
| namespace Syntax { | |
| int Tool::MosesOptionStyle() { | |
| namespace cls = boost::program_options::command_line_style; | |
| return cls::allow_long | cls::long_allow_adjacent | cls::long_allow_next; | |
| } | |
| void Tool::Warn(const std::string &msg) const { | |
| std::cerr << name_ << ": warning: " << msg << std::endl; | |
| } | |
| void Tool::Error(const std::string &msg) const { | |
| std::cerr << name_ << ": error: " << msg << std::endl; | |
| std::exit(1); | |
| } | |
| void Tool::OpenInputFileOrDie(const std::string &filename, | |
| std::ifstream &stream) { | |
| stream.open(filename.c_str()); | |
| if (!stream) { | |
| std::ostringstream msg; | |
| msg << "failed to open input file: " << filename; | |
| Error(msg.str()); | |
| } | |
| } | |
| void Tool::OpenOutputFileOrDie(const std::string &filename, | |
| std::ofstream &stream) { | |
| stream.open(filename.c_str()); | |
| if (!stream) { | |
| std::ostringstream msg; | |
| msg << "failed to open output file: " << filename; | |
| Error(msg.str()); | |
| } | |
| } | |
| void Tool::OpenOutputFileOrDie(const std::string &filename, | |
| Moses::OutputFileStream &stream) { | |
| bool ret = stream.Open(filename); | |
| if (!ret) { | |
| std::ostringstream msg; | |
| msg << "failed to open output file: " << filename; | |
| Error(msg.str()); | |
| } | |
| } | |
| } // namespace Syntax | |
| } // namespace MosesTraining | |