Model | R Documentation |
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.
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.
wordpredictor::Base
-> Model
pstats
The performance stats for the model.
name
The model name.
desc
The model description.
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.
Model$new( name = NULL, desc = NULL, fn = NULL, df = NULL, n = 4, ssize = 0.3, dir = ".", dc_opts = list(), tg_opts = list(), ve = 0 )
name
The model name.
desc
The model description.
fn
The model file name.
df
The name of the file used to generate the model.
n
The maximum n-gram number supported by the model.
ssize
The sample size as a proportion of the input file.
dir
The directory containing the model files.
dc_opts
The data cleaner options.
tg_opts
The token generator options.
ve
The level of detail in the information messages.
load_model()
It loads the model using the given information
Model$load_model()
get_config()
It returns the given configuration data
Model$get_config(cn)
cn
The name of the required configuration.
The configuration value.
get_size()
It returns the size of the current object. The object size is calculated as the sum of sizes of the object attributes.
Model$get_size()
The size of the object in bytes.
clone()
The objects of this class are cloneable with this method.
Model$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.