mirror of
https://github.com/mii443/tokenizers.git
synced 2025-08-22 16:25:30 +00:00
Fix strip python type (#1602)
* update * the fix * Revert "update" This reverts commit 4c2f32f116479b0ec8ccd7c832f86cbc8787d8a9. * add a test and rebase * style * oups
This commit is contained in:
@ -65,7 +65,7 @@ impl PyNormalizer {
|
|||||||
Py::new(py, (PyBertNormalizer {}, base))?.into_py(py)
|
Py::new(py, (PyBertNormalizer {}, base))?.into_py(py)
|
||||||
}
|
}
|
||||||
NormalizerWrapper::StripNormalizer(_) => {
|
NormalizerWrapper::StripNormalizer(_) => {
|
||||||
Py::new(py, (PyBertNormalizer {}, base))?.into_py(py)
|
Py::new(py, (PyStrip {}, base))?.into_py(py)
|
||||||
}
|
}
|
||||||
NormalizerWrapper::Prepend(_) => Py::new(py, (PyPrepend {}, base))?.into_py(py),
|
NormalizerWrapper::Prepend(_) => Py::new(py, (PyPrepend {}, base))?.into_py(py),
|
||||||
NormalizerWrapper::ByteLevel(_) => {
|
NormalizerWrapper::ByteLevel(_) => {
|
||||||
|
@ -68,12 +68,13 @@ class TestSequence:
|
|||||||
assert output == "hello"
|
assert output == "hello"
|
||||||
|
|
||||||
def test_items(self):
|
def test_items(self):
|
||||||
normalizers = Sequence([BertNormalizer(True, True), Prepend()])
|
normalizers = Sequence([BertNormalizer(True, True), Prepend(), Strip()])
|
||||||
assert normalizers[1].__class__ == Prepend
|
assert normalizers[1].__class__ == Prepend
|
||||||
normalizers[0].lowercase = False
|
normalizers[0].lowercase = False
|
||||||
assert not normalizers[0].lowercase
|
assert not normalizers[0].lowercase
|
||||||
|
assert normalizers[2].__class__ == Strip
|
||||||
with pytest.raises(IndexError):
|
with pytest.raises(IndexError):
|
||||||
print(normalizers[2])
|
print(normalizers[3])
|
||||||
|
|
||||||
|
|
||||||
class TestLowercase:
|
class TestLowercase:
|
||||||
|
Reference in New Issue
Block a user