Struct wordpieces::WordPieces
source · [−]pub struct WordPieces { /* private fields */ }
Expand description
A set of word pieces.
Implementations
sourceimpl WordPieces
impl WordPieces
sourcepub fn new(word_initial: Map<Vec<u8>>, continuation: Map<Vec<u8>>) -> Self
pub fn new(word_initial: Map<Vec<u8>>, continuation: Map<Vec<u8>>) -> Self
Construct new word pieces instance.
The arguments are set of word-initial pieces and the set o
continuation pieces. The continuation set pieces must not
have continuation markers (such as ##
).
pub fn from_buf_read(buf_read: impl BufRead) -> Result<Self, WordPiecesError>
sourcepub fn get_continuation(&self, piece: &str) -> Option<u64>
pub fn get_continuation(&self, piece: &str) -> Option<u64>
Look up the index of an initial word piece.
sourcepub fn get_initial(&self, piece: &str) -> Option<u64>
pub fn get_initial(&self, piece: &str) -> Option<u64>
Look up the index of an continuation word piece.
Trait Implementations
sourceimpl From<&WordPieces> for Vec<String>
impl From<&WordPieces> for Vec<String>
sourcefn from(word_pieces: &WordPieces) -> Self
fn from(word_pieces: &WordPieces) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for WordPieces
impl Send for WordPieces
impl Sync for WordPieces
impl Unpin for WordPieces
impl UnwindSafe for WordPieces
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more