Sample sequences from a k-gram language model.
More...
#include <Sampler.h>
|
| Sampler (Smoother prob) |
| Initialize a Sampler from a given smoother object. More...
|
|
std::string | sample_sentence (size_t max_length, double T=1.0) |
| Sample a sentence from the probability distribution specified by the smoother. More...
|
|
template<class Smoother>
class Sampler< Smoother >
Sample sequences from a k-gram language model.
- Template Parameters
-
Smoother | Smoother object for sampling probabilities of k-grams. |
◆ Sampler()
template<class Smoother >
Initialize a Sampler from a given smoother object.
- Parameters
-
prob | the smoother to be used for generating sampling probabilities. |
◆ sample_sentence()
template<class Smoother >
std::string Sampler< Smoother >::sample_sentence |
( |
size_t |
max_length, |
|
|
double |
T = 1.0 |
|
) |
| |
|
inline |
Sample a sentence from the probability distribution specified by the smoother.
- Parameters
-
max_length | Maximum length of sampled sequences (truncation occurs if max_length is reached). |
T | optional temperature parameter. Defaults to 1.0. |
- Returns
- A string. Sampled sentence.
The documentation for this class was generated from the following file: