kgrams  0.1.0
Public Member Functions | List of all members
Sampler< Smoother > Class Template Reference

Sample sequences from a k-gram language model. More...

#include <Sampler.h>

Public Member Functions

 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...
 

Detailed Description

template<class Smoother>
class Sampler< Smoother >

Sample sequences from a k-gram language model.

Template Parameters
SmootherSmoother object for sampling probabilities of k-grams.

Constructor & Destructor Documentation

◆ Sampler()

template<class Smoother >
Sampler< Smoother >::Sampler ( Smoother  prob)
inline

Initialize a Sampler from a given smoother object.

Parameters
probthe smoother to be used for generating sampling probabilities.

Member Function Documentation

◆ 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_lengthMaximum length of sampled sequences (truncation occurs if max_length is reached).
Toptional temperature parameter. Defaults to 1.0.
Returns
A string. Sampled sentence.

The documentation for this class was generated from the following file: