use flodl_hf::models::roberta::RobertaForTokenClassification;
fn main() -> flodl::Result<()> {
let ner = RobertaForTokenClassification::from_pretrained(
"Jean-Baptiste/roberta-large-ner-english",
)?;
let sentences = &[
"fab2s writes Rust code in Latent",
"Anthropic built Claude in San Francisco",
];
let tagged = ner.predict(sentences)?;
for (sentence, tokens) in sentences.iter().zip(&tagged) {
println!("{sentence:?}");
for t in tokens {
if !t.attends { continue; }
if t.label == "O" { continue; }
println!(" {:<15} {:<8} ({:.3})", t.token, t.label, t.score);
}
}
Ok(())
}