kgrams  0.1.0
Public Member Functions | Friends | List of all members
AddkSmoother Class Reference

Add-k continuation probability smoother. More...

#include <Smoothers.h>

Public Member Functions

 AddkSmoother (kgramFreqs &f, const double &k)
 Initialize an AddkSmoother from a kgramFreqs object with a fixed constant 'k'. More...
 
double operator() (const std::string &word, std::string context)
 Return Add-k continuation probability of a word given a context. More...
 

Friends

class Sampler< AddkSmoother >
 

Detailed Description

Add-k continuation probability smoother.

Constructor & Destructor Documentation

◆ AddkSmoother()

AddkSmoother::AddkSmoother ( kgramFreqs f,
const double &  k 
)
inline

Initialize an AddkSmoother from a kgramFreqs object with a fixed constant 'k'.

Parameters
fa kgramFreqs class object. k-gram frequency table from which "bare" k-gram counts are read off.
kpositive number. Constant weight added to k-gram counts.

Member Function Documentation

◆ operator()()

double AddkSmoother::operator() ( const std::string &  word,
std::string  context 
)
inline

Return Add-k continuation probability of a word given a context.

Parameters
wordA string. Word for which the continuation probability is to be computed.
contextA string. Context conditioning the probability of 'word'.
Returns
a positive number. Add-k continuation probability of 'word' given 'context'.

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