Rust - Fix WordLevelTrainer default values

This commit is contained in:
Anthony MOI
2020-12-08 13:16:03 -05:00
committed by Anthony MOI
parent d71e66e53c
commit a3a9561f9f

View File

@ -7,13 +7,13 @@ use std::collections::HashMap;
#[derive(Debug, Clone, Builder)]
pub struct WordLevelTrainer {
/// The minimum frequency a word must have to be part of the vocabulary
#[builder(default)]
#[builder(default = "0")]
pub min_frequency: u32,
/// The target vocabulary size
#[builder(default)]
#[builder(default = "30_000")]
pub vocab_size: usize,
/// Whether to show progress while training
#[builder(default)]
#[builder(default = "true")]
pub show_progress: bool,
/// A list of special tokens that the model should know of
#[builder(default)]
@ -25,13 +25,7 @@ pub struct WordLevelTrainer {
impl Default for WordLevelTrainer {
fn default() -> Self {
Self {
min_frequency: 0,
vocab_size: 30_000,
show_progress: true,
special_tokens: vec![],
words: HashMap::new(),
}
Self::builder().build().unwrap()
}
}