use flodl_hf::models::bert::BertForTokenClassification;
fn main() -> flodl::Result<()> {
let ner = BertForTokenClassification::from_pretrained("dslim/bert-base-NER")?;
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(())
}