Learn R Programming

tok (version 0.2.0)

model_unigram: An implementation of the Unigram algorithm

Description

An implementation of the Unigram algorithm

An implementation of the Unigram algorithm

Arguments

Super class

tok::tok_model -> tok_model_unigram

Methods


Method new()

Constructor for Unigram Model

Usage

model_unigram$new(vocab = NULL, unk_id = NULL, byte_fallback = FALSE)

Arguments

vocab

A dictionary of string keys and their corresponding relative score. Default: NULL.

unk_id

The unknown token id to be used by the model. Default: NULL.

byte_fallback

Whether to use byte-fallback trick. Default: FALSE.


Method clone()

The objects of this class are cloneable with this method.

Usage

model_unigram$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

See Also

Other model: model_bpe, model_wordpiece, tok_model