The Model class represents n-gram models. An instance of the class is a single n-gram model. The attributes of this class are used to store n-gram model information. The class provides methods for loading and saving the model.
Details
The attributes of this class are used to store n-gram model information such as model name, model description, model file name, n-gram size, transition probabilities data, default probability for words, data cleaning and tokenization options, word list, model path, data directory path and performance stats. The model is saved to a single file as a R object.
A model file contains all the information required by the model. The model object is used as input by classes that perform operations on the model such as evaluation of model performance, text predictions and comparison of model performance.
Super class
wordpredictor::Base -> Model
Public fields
pstatsThe performance stats for the model.
nameThe model name.
descThe model description.
Methods
Method new()
It initializes the current object. It is used to set the maximum n-gram number, sample size, input file name, data cleaner options, tokenization options, combined transition probabilities file name and verbose.
Arguments
nameThe model name.
descThe model description.
fnThe model file name.
dfThe name of the file used to generate the model.
nThe maximum n-gram number supported by the model.
ssizeThe sample size as a proportion of the input file.
dirThe directory containing the model files.
dc_optsThe data cleaner options.
tg_optsThe token generator options.
veThe level of detail in the information messages.
Method get_size()
It returns the size of the current object. The object size is calculated as the sum of sizes of the object attributes.