Expand description
§nerrs
CRF-based Named Entity Recognition for Persian text.
Uses crfrs for model training and Viterbi inference.
§Entity types
The default tagset uses BIO encoding over these entity classes:
| Tag | Meaning |
|---|---|
O | Outside any entity |
B-PER / I-PER | Person name |
B-ORG / I-ORG | Organisation |
B-LOC / I-LOC | Location |
B-DAT / I-DAT | Date |
B-TIM / I-TIM | Time |
B-MON / I-MON | Money / currency amount |
B-PCT / I-PCT | Percentage |
B-EVE / I-EVE | Event |
§Quick start
use nerrs::NerTagger;
let mut tagger = NerTagger::new();
tagger.load_model("ner.model").unwrap();
let entities = tagger.tag(&["علی", "به", "تهران", "رفت", "."]).unwrap();
// → [("علی","B-PER"), ("به","O"), ("تهران","B-LOC"), ("رفت","O"), (".","O")]§Training
use nerrs::{NerTagger, crfrs::TrainConfig};
// IOB-tagged corpus: Vec<Vec<(word, ner_tag)>>
let corpus: Vec<Vec<(String, String)>> = vec![];
NerTagger::train_and_save(&corpus, "ner.model", TrainConfig::default()).unwrap();Re-exports§
pub use error::Error;pub use error::Result;pub use tagger::extract_entities;pub use tagger::NerTagger;pub use crfrs;
Modules§
- error
- Error types for nerrs.
- features
- Feature extraction for Persian NER.
- tagger
- CRF-based Persian NER tagger.
Constants§
- DEFAULT_
LABELS - Default NER labels in BIO encoding.