///////////////////////////////////////////////////////// Simple API.
| 377 | ////////////////////////////////////////////////////////////// |
| 378 | // Simple API. |
| 379 | util::Status SentencePieceProcessor::Encode( |
| 380 | absl::string_view input, std::vector<std::string> *pieces) const { |
| 381 | CHECK_OR_RETURN_STATUS_STL(pieces); |
| 382 | |
| 383 | SentencePieceText spt; |
| 384 | RETURN_IF_ERROR(Encode(input, &spt)); |
| 385 | for (const auto &sp : spt.pieces()) { |
| 386 | pieces->emplace_back(sp.piece()); |
| 387 | } |
| 388 | |
| 389 | return util::OkStatus(); |
| 390 | } |
| 391 | |
| 392 | util::Status SentencePieceProcessor::Encode(absl::string_view input, |
| 393 | std::vector<int> *ids) const { |