pub struct BackendFactory;Expand description
Factory for creating backend instances from names.
Implementations§
Source§impl BackendFactory
impl BackendFactory
Sourcepub fn create(backend_name: &str) -> Result<Box<dyn Model>>
pub fn create(backend_name: &str) -> Result<Box<dyn Model>>
Create a backend instance from a name.
§Supported Backends
§Always Available
pattern/RegexNER- Pattern-based NERheuristic/HeuristicNER- Heuristic NERstacked/StackedNER- Stacked NER
§ONNX Feature Required
bert_onnx/BertNEROnnx- BERT ONNX NERgliner_onnx/GLiNEROnnx- GLiNER ONNX (zero-shot)nuner/NuNER- NuNER (zero-shot, token-based)w2ner/W2NER- W2NER (discontinuous NER)gliner_multitask/GLiNERMultitaskOnnx- GLiNERMultitask multi-task
§Candle Feature Required
candle_ner/CandleNER- Candle BERT NERgliner_candle/GLiNERCandle- GLiNER Candle (zero-shot)gliner_multitask_candle/GLiNERMultitaskCandle- GLiNERMultitask Candle
§Coreference
coref_resolver/SimpleCorefResolver- Simple coreference resolver
§Example
ⓘ
use anno_eval::eval::backend_factory::BackendFactory;
let backend = BackendFactory::create("pattern")?;
let entities = backend.extract_entities("Meeting on Jan 15", None)?;Sourcepub fn available_backends() -> Vec<&'static str>
pub fn available_backends() -> Vec<&'static str>
List all available backends (based on enabled features).
Sourcepub fn available_coref_resolvers() -> Vec<&'static str>
pub fn available_coref_resolvers() -> Vec<&'static str>
List all available coreference resolvers.
Coreference resolvers are not Models, so they are kept separate from
Self::available_backends. They are used by TaskEvaluator for coref-family tasks.
Sourcepub fn is_available(backend_name: &str) -> bool
pub fn is_available(backend_name: &str) -> bool
Check if a backend is available (feature-enabled).
Auto Trait Implementations§
impl Freeze for BackendFactory
impl RefUnwindSafe for BackendFactory
impl Send for BackendFactory
impl Sync for BackendFactory
impl Unpin for BackendFactory
impl UnsafeUnpin for BackendFactory
impl UnwindSafe for BackendFactory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more