pub fn stratified_sample_ner(
cases: &[(String, Vec<GoldEntity>)],
target_size: usize,
seed: u64,
type_mapper: Option<&TypeMapper>,
) -> Vec<(String, Vec<GoldEntity>)>Expand description
Stratified sampling with entity type awareness.
Groups cases by their primary entity type and samples proportionally from each group to maintain the original type distribution.
§Arguments
cases- Input test casestarget_size- Maximum cases to returnseed- Random seed for reproducibilitytype_mapper- Optional mapper for normalizing domain-specific types
§Example
use anno_eval::eval::sampling::stratified_sample_ner;
use anno_eval::eval::datasets::GoldEntity;
use anno::EntityType;
let cases = vec![
("John works at Apple".into(), vec![
GoldEntity::new("John", EntityType::Person, 0),
]),
];
let sample = stratified_sample_ner(&cases, 100, 42, None);