| 721 | } |
| 722 | |
| 723 | EncodeResult Model::SampleEncode(absl::string_view normalized, |
| 724 | float inv_theta) const { |
| 725 | if (!status().ok() || normalized.empty()) { |
| 726 | return {}; |
| 727 | } |
| 728 | |
| 729 | Lattice lattice; |
| 730 | lattice.SetSentence(normalized); |
| 731 | PopulateNodes(&lattice); |
| 732 | |
| 733 | EncodeResult results; |
| 734 | for (const auto *node : lattice.Sample(inv_theta)) { |
| 735 | results.emplace_back(node->piece, node->id); |
| 736 | } |
| 737 | |
| 738 | return results; |
| 739 | } |
| 740 | |
| 741 | NBestEncodeResult Model::SampleEncodeAndScore(absl::string_view normalized, |
| 742 | float inv_theta, int samples, |
nothing calls this directly
no test coverage detected