Vowpal Wabbit
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
VW::kskip_ngram_transformer Class Reference

#include <kskip_ngram_transformer.h>

Public Member Functions

void generate_grams (example *ex)
 
std::vector< std::string > get_initial_ngram_definitions () const
 
std::vector< std::string > get_initial_skip_definitions () const
 
 kskip_ngram_transformer (const kskip_ngram_transformer &other)=default
 
kskip_ngram_transformeroperator= (const kskip_ngram_transformer &other)=default
 
 kskip_ngram_transformer (kskip_ngram_transformer &&other)=default
 
kskip_ngram_transformeroperator= (kskip_ngram_transformer &&other)=default
 

Static Public Member Functions

static kskip_ngram_transformer build (const std::vector< std::string > &grams, const std::vector< std::string > &skips, bool quiet, VW::io::logger &logger)
 

Constructor & Destructor Documentation

◆ kskip_ngram_transformer() [1/2]

VW::kskip_ngram_transformer::kskip_ngram_transformer ( const kskip_ngram_transformer other)
default

◆ kskip_ngram_transformer() [2/2]

VW::kskip_ngram_transformer::kskip_ngram_transformer ( kskip_ngram_transformer &&  other)
default

Member Function Documentation

◆ build()

static kskip_ngram_transformer VW::kskip_ngram_transformer::build ( const std::vector< std::string > &  grams,
const std::vector< std::string > &  skips,
bool  quiet,
VW::io::logger logger 
)
static

◆ generate_grams()

void VW::kskip_ngram_transformer::generate_grams ( example ex)

This function adds k-skip-n-grams to the feature vector. Definition of k-skip-n-grams: Consider a feature vector - a, b, c, d, e, f 2-skip-2-grams would be - ab, ac, ad, bc, bd, be, cd, ce, cf, de, df, ef 1-skip-3-grams would be - abc, abd, acd, ace, bcd, bce, bde, bdf, cde, cdf, cef, def Note that for a n-gram, (n-1)-grams, (n-2)-grams... 2-grams are also appended The k-skip-n-grams are appended to the feature vector. Hash is evaluated using the principle h(a, b) = h(a)*X + h(b), where X is a random no. 32 random nos. are maintained in an array and are used in the hashing.

◆ get_initial_ngram_definitions()

std::vector< std::string > VW::kskip_ngram_transformer::get_initial_ngram_definitions ( ) const
inline

◆ get_initial_skip_definitions()

std::vector< std::string > VW::kskip_ngram_transformer::get_initial_skip_definitions ( ) const
inline

◆ operator=() [1/2]

kskip_ngram_transformer & VW::kskip_ngram_transformer::operator= ( const kskip_ngram_transformer other)
default

◆ operator=() [2/2]

kskip_ngram_transformer & VW::kskip_ngram_transformer::operator= ( kskip_ngram_transformer &&  other)
default

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