Skip to main content

label_from_f1

Function label_from_f1 

Source
pub fn label_from_f1(
    contents: &[CandidateContent],
    ground_truth: &str,
    stopwords: &HashSet<String>,
) -> Option<Vec<f32>>
Expand description

Derive the supervised label vector for one page: 1.0 for the candidate whose extracted text best matches the ground truth (token F1), 0.0 for the rest.

Returns None when there is no ground truth or no candidate scores above zero (nothing to learn from for this page).