pub struct SchemaMapper {
pub source_schema: DatasetSchema,
/* private fields */
}Expand description
Maps dataset-specific labels to canonical types.
Fields§
§source_schema: DatasetSchemaThe source dataset schema
Implementations§
Source§impl SchemaMapper
impl SchemaMapper
Sourcepub fn for_dataset(schema: DatasetSchema) -> Self
pub fn for_dataset(schema: DatasetSchema) -> Self
Create a mapper for a specific dataset.
Sourcepub fn to_canonical(&self, label: &str) -> CanonicalType
pub fn to_canonical(&self, label: &str) -> CanonicalType
Map a dataset label to canonical type.
Sourcepub fn information_loss(&self, label: &str) -> Option<&InformationLoss>
pub fn information_loss(&self, label: &str) -> Option<&InformationLoss>
Get information loss for a label (if any).
Sourcepub fn to_entity_type(&self, label: &str) -> EntityType
pub fn to_entity_type(&self, label: &str) -> EntityType
Map to EntityType for compatibility with existing code.
Sourcepub fn all_losses(&self) -> impl Iterator<Item = &InformationLoss>
pub fn all_losses(&self) -> impl Iterator<Item = &InformationLoss>
Get all mappings that have information loss.
Sourcepub fn label_overlap(&self, other: &SchemaMapper) -> f64
pub fn label_overlap(&self, other: &SchemaMapper) -> f64
Calculate label overlap with another schema.
Used to detect if “zero-shot” evaluation is actually fair. High overlap (>80%) means evaluation inflates scores.
Trait Implementations§
Source§impl Clone for SchemaMapper
impl Clone for SchemaMapper
Source§fn clone(&self) -> SchemaMapper
fn clone(&self) -> SchemaMapper
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SchemaMapper
impl RefUnwindSafe for SchemaMapper
impl Send for SchemaMapper
impl Sync for SchemaMapper
impl Unpin for SchemaMapper
impl UnsafeUnpin for SchemaMapper
impl UnwindSafe for SchemaMapper
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,
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