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-05-06 18:51:20 +0300
committerTaku Kudo <taku@google.com>2018-05-06 18:51:20 +0300
commitcf0eb82d65850172a4661e47668938ab82cb2c76 (patch)
treefa6414db5714c6fd15f725d5a9e28cbcb14e20c2 /src/model_interface.cc
parent31153b117294830ab41ff3e9ee4f0a7323f16d8d (diff)
CHECK to Status migration for Trainer.
Diffstat (limited to 'src/model_interface.cc')
-rw-r--r--src/model_interface.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/model_interface.cc b/src/model_interface.cc
index 059e8bf..62ecf17 100644
--- a/src/model_interface.cc
+++ b/src/model_interface.cc
@@ -63,7 +63,8 @@ void ModelInterface::InitializePieces(bool enable_user_defined) {
const auto &sp = model_proto_->pieces(i);
if (!enable_user_defined &&
sp.type() == ModelProto::SentencePiece::USER_DEFINED) {
- status_ = util::InternalError("User defined symbol is not supported.");
+ status_ = util::StatusBuilder(util::error::INTERNAL)
+ << "user defined symbol is not supported.";
return;
}
@@ -72,7 +73,8 @@ void ModelInterface::InitializePieces(bool enable_user_defined) {
sp.type() == ModelProto::SentencePiece::USER_DEFINED);
if (!port::InsertIfNotPresent(
is_normal_piece ? &pieces_ : &reserved_id_map_, sp.piece(), i)) {
- status_ = util::InternalError(sp.piece() + " is already defined.");
+ status_ = util::StatusBuilder(util::error::INTERNAL)
+ << "\"" << sp.piece() << "\" is already defined.";
return;
}
@@ -94,7 +96,6 @@ std::vector<StringPiece> SplitIntoWords(StringPiece text) {
if (begin == text.data() || StringPiece(begin, mblen) == kSpaceSymbol) {
result.emplace_back(begin, 0); // add empty string piece.
}
- CHECK(!result.empty());
result.back() =
StringPiece(result.back().data(), result.back().size() + mblen);
begin += mblen;