Struct nnsplit::tract_backend::NNSplit
source · pub struct NNSplit { /* private fields */ }
Expand description
Complete splitter using tract as backend.
Implementations§
source§impl NNSplit
impl NNSplit
sourcepub fn new<P: AsRef<Path>>(
model_path: P,
options: NNSplitOptions
) -> Result<Self, Box<dyn Error>>
pub fn new<P: AsRef<Path>>( model_path: P, options: NNSplitOptions ) -> Result<Self, Box<dyn Error>>
Create a new splitter from the given model location.
Errors
- If the file can not be loaded as tract model.
sourcepub fn load(
model_name: &str,
options: NNSplitOptions
) -> Result<Self, Box<dyn Error>>
pub fn load( model_name: &str, options: NNSplitOptions ) -> Result<Self, Box<dyn Error>>
Loads a built-in model. From the local cache or from the internet if it is not cached.
sourcepub fn split<'a>(&self, texts: &[&'a str]) -> Vec<Split<'a>>
pub fn split<'a>(&self, texts: &[&'a str]) -> Vec<Split<'a>>
Split a list of texts into a list of Split
objects.
sourcepub fn logic(&self) -> &NNSplitLogic
pub fn logic(&self) -> &NNSplitLogic
Gets the underlying NNSplitLogic.
Auto Trait Implementations§
impl !RefUnwindSafe for NNSplit
impl Send for NNSplit
impl Sync for NNSplit
impl Unpin for NNSplit
impl !UnwindSafe for NNSplit
Blanket Implementations§
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.