@@ -422,9 +422,7 @@ impl PySplit {
422
422
423
423
#[ getter]
424
424
fn get_behavior ( self_ : PyRef < Self > ) -> String {
425
- getter ! ( self_, Punctuation , behavior)
426
- . to_string ( )
427
- . to_lowercase ( )
425
+ getter ! ( self_, Split , behavior) . to_string ( ) . to_lowercase ( )
428
426
}
429
427
430
428
#[ setter]
@@ -442,7 +440,7 @@ impl PySplit {
442
440
) )
443
441
}
444
442
} ;
445
- setter ! ( self_, Punctuation , behavior, behavior) ;
443
+ setter ! ( self_, Split , behavior, behavior) ;
446
444
Ok ( ( ) )
447
445
}
448
446
@@ -586,24 +584,25 @@ impl PySequence {
586
584
"Index not found" ,
587
585
) ) ,
588
586
} ,
589
- PyPreTokenizerTypeWrapper :: Single ( inner) => {
590
- PyPreTokenizer :: new ( PyPreTokenizerTypeWrapper :: Single ( inner. clone ( ) ) )
591
- . get_as_subtype ( py)
592
- }
587
+ _ => Err ( PyErr :: new :: < pyo3:: exceptions:: PyIndexError , _ > (
588
+ "This processor is not a Sequence, it does not support __getitem__" ,
589
+ ) ) ,
593
590
}
594
591
}
595
592
596
593
fn __setitem__ ( self_ : PyRef < ' _ , Self > , index : usize , value : Bound < ' _ , PyAny > ) -> PyResult < ( ) > {
597
594
let pretok: PyPreTokenizer = value. extract ( ) ?;
598
- let PyPreTokenizerTypeWrapper :: Single ( norm) = pretok. pretok else {
599
- return Err ( PyException :: new_err ( "normalizer should not be a sequence" ) ) ;
595
+ let PyPreTokenizerTypeWrapper :: Single ( pretok) = pretok. pretok else {
596
+ return Err ( PyException :: new_err (
597
+ "pre tokenizer should not be a sequence" ,
598
+ ) ) ;
600
599
} ;
601
600
match & self_. as_ref ( ) . pretok {
602
601
PyPreTokenizerTypeWrapper :: Sequence ( inner) => match inner. get ( index) {
603
602
Some ( item) => {
604
603
* item
605
604
. write ( )
606
- . map_err ( |_| PyException :: new_err ( "RwLock synchronisation primitive is poisoned, cannot get subtype of PyPreTokenizer" ) ) ? = ( * norm
605
+ . map_err ( |_| PyException :: new_err ( "RwLock synchronisation primitive is poisoned, cannot get subtype of PyPreTokenizer" ) ) ? = ( * pretok
607
606
. read ( )
608
607
. map_err ( |_| PyException :: new_err ( "RwLock synchronisation primitive is poisoned, cannot get subtype of PyPreTokenizer" ) ) ?)
609
608
. clone ( ) ;
0 commit comments