#[cfg(feature = "hf-hub")]
use std::path::PathBuf;
#[cfg(feature = "hf-hub")]
use crate::error::{Error, Result};
pub enum Model {
PosTagger,
Chunker,
Ner,
DepParser,
FastText,
Word2Vec,
}
#[cfg(feature = "hf-hub")]
pub fn download(model: Model) -> Result<PathBuf> {
use hf_hub::api::sync::Api;
let (repo_id, filename): (&str, &str) = match model {
Model::PosTagger => ("amirhosseinghanipour/rustam-postagger", "pos_tagger.model"),
Model::Chunker => ("amirhosseinghanipour/rustam-chunker", "chunker.model"),
Model::Ner => ("amirhosseinghanipour/rustam-ner", "ner.model"),
Model::DepParser => ("amirhosseinghanipour/rustam-dependency-parser", "dep.model"),
Model::FastText => ("amirhosseinghanipour/rustam-word-embedding", "fasttext_skipgram_300.bin"),
Model::Word2Vec => ("amirhosseinghanipour/rustam-word-embedding", "word2vec.bin"),
};
let api = Api::new().map_err(|e| Error::Parse(e.to_string()))?;
api.model(repo_id.to_string())
.get(filename)
.map_err(|e| Error::Parse(format!("HF Hub download failed: {e}")))
}