mirror of
https://github.com/mii443/tokenizers.git
synced 2025-08-23 00:35:35 +00:00
Python - Add encoding getters
This commit is contained in:
@ -13,3 +13,36 @@ impl Encoding {
|
||||
Encoding { encoding }
|
||||
}
|
||||
}
|
||||
|
||||
#[pymethods]
|
||||
impl Encoding {
|
||||
#[getter]
|
||||
fn get_original(&self) -> String {
|
||||
self.encoding.get_original().to_owned()
|
||||
}
|
||||
|
||||
#[getter]
|
||||
fn get_normalized(&self) -> String {
|
||||
self.encoding.get_normalized().to_owned()
|
||||
}
|
||||
|
||||
#[getter]
|
||||
fn get_ids(&self) -> Vec<u32> {
|
||||
self.encoding.get_ids().to_vec()
|
||||
}
|
||||
|
||||
#[getter]
|
||||
fn get_tokens(&self) -> Vec<String> {
|
||||
self.encoding.get_tokens().to_vec()
|
||||
}
|
||||
|
||||
#[getter]
|
||||
fn get_type_ids(&self) -> Vec<u32> {
|
||||
self.encoding.get_type_ids().to_vec()
|
||||
}
|
||||
|
||||
#[getter]
|
||||
fn get_offsets(&self) -> Vec<(usize, usize)> {
|
||||
self.encoding.get_offsets().to_vec()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user