File tree Expand file tree Collapse file tree
algorithms/linfa-preprocessing/src/countgrams Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,8 +35,7 @@ impl SerdeRegex {
3535 }
3636
3737 fn as_re ( & self ) -> & Regex {
38- use std:: ops:: Deref ;
39- & self . 0 . deref ( )
38+ & self . 0
4039 }
4140}
4241
@@ -68,6 +67,7 @@ impl SerdeRegex {
6867pub struct CountVectorizerValidParams {
6968 convert_to_lowercase : bool ,
7069 split_regex_expr : String ,
70+ #[ cfg_attr( feature = "serde" , serde( skip, default = "OnceLock::new" ) ) ]
7171 split_regex : OnceLock < SerdeRegex > ,
7272 n_gram_range : ( usize , usize ) ,
7373 normalize : bool ,
@@ -95,7 +95,7 @@ impl CountVectorizerValidParams {
9595 pub fn split_regex ( & self ) -> & Regex {
9696 self . split_regex
9797 . get ( )
98- . expect ( "Regex not initialized" )
98+ . expect ( "Regex not initialized; call `check_ref()` first " )
9999 . as_re ( )
100100 }
101101
@@ -124,7 +124,7 @@ impl CountVectorizerValidParams {
124124#[ derive( Clone , Debug ) ]
125125pub struct CountVectorizerParams ( CountVectorizerValidParams ) ;
126126
127- impl std :: default :: Default for CountVectorizerParams {
127+ impl Default for CountVectorizerParams {
128128 fn default ( ) -> Self {
129129 Self ( CountVectorizerValidParams {
130130 convert_to_lowercase : true ,
You can’t perform that action at this time.
0 commit comments