Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/sentencepiece.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaku Kudo <taku@google.com>2018-04-28 20:50:07 +0300
committerTaku Kudo <taku@google.com>2018-04-28 20:50:07 +0300
commitd16531bfb866e2fca246a36316876b934aa427f7 (patch)
tree0215e1b3555b02363b17d425b3c94200d92cb6fd /src/spm_decode_main.cc
parentbaf5d7a2995018ede996173cdf0febcdf23cba2d (diff)
Uses util::Status to propagate error messages
Diffstat (limited to 'src/spm_decode_main.cc')
-rw-r--r--src/spm_decode_main.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/spm_decode_main.cc b/src/spm_decode_main.cc
index 4561e07..baf91a6 100644
--- a/src/spm_decode_main.cc
+++ b/src/spm_decode_main.cc
@@ -33,8 +33,8 @@ int main(int argc, char *argv[]) {
CHECK_OR_HELP(model);
sentencepiece::SentencePieceProcessor sp;
- sp.LoadOrDie(FLAGS_model);
- sp.SetDecodeExtraOptions(FLAGS_extra_options);
+ CHECK_OK(sp.Load(FLAGS_model));
+ CHECK_OK(sp.SetDecodeExtraOptions(FLAGS_extra_options));
sentencepiece::io::OutputBuffer output(FLAGS_output);
@@ -57,12 +57,12 @@ int main(int argc, char *argv[]) {
if (FLAGS_input_format == "piece") {
if (FLAGS_output_format == "string") {
process = [&](const std::vector<std::string> &pieces) {
- sp.Decode(pieces, &detok);
+ CHECK_OK(sp.Decode(pieces, &detok));
output.WriteLine(detok);
};
} else if (FLAGS_output_format == "proto") {
process = [&](const std::vector<std::string> &pieces) {
- sp.Decode(pieces, &spt);
+ CHECK_OK(sp.Decode(pieces, &spt));
output.WriteLine(spt.Utf8DebugString());
};
} else {
@@ -71,12 +71,12 @@ int main(int argc, char *argv[]) {
} else if (FLAGS_input_format == "id") {
if (FLAGS_output_format == "string") {
process = [&](const std::vector<std::string> &pieces) {
- sp.Decode(ToIds(pieces), &detok);
+ CHECK_OK(sp.Decode(ToIds(pieces), &detok));
output.WriteLine(detok);
};
} else if (FLAGS_output_format == "proto") {
process = [&](const std::vector<std::string> &pieces) {
- sp.Decode(ToIds(pieces), &spt);
+ CHECK_OK(sp.Decode(ToIds(pieces), &spt));
output.WriteLine(spt.Utf8DebugString());
};
} else {