| 128 | } |
| 129 | |
| 130 | bool Word2vecSampling::Init(const vec_float_t& freqs) { |
| 131 | if (freqs.empty()) { |
| 132 | DXERROR("Frequency tables are empty!"); |
| 133 | return false; |
| 134 | } |
| 135 | Clear(); |
| 136 | return table_.Init(freqs); |
| 137 | } |
| 138 | |
| 139 | std::unique_ptr<Sampling> NewWord2vecSampling(const vec_float_t* probs) { |
| 140 | return Word2vecSampling::Create(*probs); |