| 470 | } |
| 471 | |
| 472 | util::Status SentencePieceProcessor::SampleEncode( |
| 473 | absl::string_view input, int nbest_size, float alpha, |
| 474 | std::vector<std::string> *pieces) const { |
| 475 | CHECK_OR_RETURN_STATUS_STL(pieces); |
| 476 | |
| 477 | SentencePieceText spt; |
| 478 | RETURN_IF_ERROR(SampleEncode(input, nbest_size, alpha, &spt)); |
| 479 | pieces->reserve(spt.pieces().size()); |
| 480 | for (const auto &sp : spt.pieces()) { |
| 481 | pieces->emplace_back(sp.piece()); |
| 482 | } |
| 483 | |
| 484 | return util::OkStatus(); |
| 485 | } |
| 486 | |
| 487 | util::Status SentencePieceProcessor::SampleEncode(absl::string_view input, |
| 488 | int nbest_size, float alpha, |
nothing calls this directly
no test coverage detected