pub struct Candidate {
pub text: String,
pub confidence: f64,
pub predicted_types: Vec<String>,
pub committee_predictions: Vec<Vec<String>>,
pub embedding: Option<Vec<f64>>,
}Expand description
A candidate example for annotation.
Fields§
§text: StringText to potentially annotate
confidence: f64Model’s confidence on this example (lower = more uncertain)
predicted_types: Vec<String>Optional: entity types predicted
committee_predictions: Vec<Vec<String>>Optional: multiple model predictions for committee sampling
embedding: Option<Vec<f64>>Optional: embedding for diversity sampling (required for Diversity strategy)
Implementations§
Source§impl Candidate
impl Candidate
Sourcepub fn new(text: impl Into<String>, confidence: f64) -> Self
pub fn new(text: impl Into<String>, confidence: f64) -> Self
Create a simple candidate with text and confidence.
Sourcepub fn with_types(self, types: Vec<String>) -> Self
pub fn with_types(self, types: Vec<String>) -> Self
Create candidate with predicted types.
Sourcepub fn with_committee(self, predictions: Vec<Vec<String>>) -> Self
pub fn with_committee(self, predictions: Vec<Vec<String>>) -> Self
Create candidate with committee predictions.
Sourcepub fn with_embedding(self, embedding: Vec<f64>) -> Self
pub fn with_embedding(self, embedding: Vec<f64>) -> Self
Create candidate with embedding.
Sourcepub fn has_committee(&self) -> bool
pub fn has_committee(&self) -> bool
Check if this candidate has valid committee predictions (≥2 models).
Sourcepub fn has_embedding(&self) -> bool
pub fn has_embedding(&self) -> bool
Check if this candidate has an embedding.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Candidate
impl RefUnwindSafe for Candidate
impl Send for Candidate
impl Sync for Candidate
impl Unpin for Candidate
impl UnsafeUnpin for Candidate
impl UnwindSafe for Candidate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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