Token Classification
Transformers
ONNX
Safetensors
English
Japanese
Chinese
bert
anime
filename-parsing
Eval Results (legacy)
Run this model with HF Jobs
Run ModerRAS/AniFileBERT on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/ModerRAS/AniFileBERT. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ModerRAS/AniFileBERT on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use ModerRAS/AniFileBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ModerRAS/AniFileBERT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="ModerRAS/AniFileBERT")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("ModerRAS/AniFileBERT") model = AutoModelForTokenClassification.from_pretrained("ModerRAS/AniFileBERT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Improve DMHY low-frequency metadata handling
Browse files221 unmodified lines2222232242252262272281978 unmodified lines2207220822092210221122129 unmodified lines222222232224222522262227222886 unmodified lines231523162317231823192320407 unmodified lines2728272927302731273227332734273527362737389 unmodified lines312731283129313031313132675 unmodified lines38083809381038113812221 unmodified linesRegex::new(r"(?i)^(?:CHS|CHT|ZHS|ZHT|GB|BIG5|JPN?|JP|JA|JAP|ENG|EN|SC|TC|简[体體]?|繁[体體]?|简日|繁日|字幕|内封|外挂|Sub|Subs|MSubs?)$").unwrap()});static MEDIA_RE: Lazy<Regex> = Lazy::new(|| {Regex::new(r"(?i)^(?:WEB|WEB[-_. ]?DL|WEB[-_. ]?Rip|BDRip|BluRay|BDMV|BD|DVDRip|DVD|HD|UHD|HDTV|TVRip|REMUX|xvid|x26[45]|h\.?26[45]|HEVC|AVC|AV1|YUV\d+P?\d*|AAC\s*\d*(?:\.\d+)?|DDP\s*\d*(?:\.\d+)?|FLAC|MP3|DTS|HDMA|DTS-HDMA|E?AC3x?\d*(?:\.\d+)?|Opus|WMV\d*|\d(?:\.\d)?ch|10[-_. ]?bit|8[-_. ]?bit|Hi10p|Ma10p|ASSx?\d*|SRTx?\d*|SUP|R\d[A-Z]*|NoSub|MKV|MP4|AVI|RAW|Raws?)$").unwrap()});static SPECIAL_TITLE_PHRASE_RE: Lazy<Regex> = Lazy::new(|| {Regex::new(r"(?i)\b(?:theater\s+greeting\s+event|world\s+prem(?:eie|iere)|picture\s+drama)\b")1978 unmodified lines|| SPECIAL_TITLE_PHRASE_RE.is_match(text)}const KNOWN_TITLE_PHRASES: &[&[&str]] = &[&["SPY", "x", "FAMILY"],&["Spy", "x", "Family"],9 unmodified linesfn apply_known_title_phrases(tokens: &[String], groups: &[Group], roles: &mut [String]) {if let Some(whitelists) = RUNTIME_WHITELISTS.get() {for (index, group) in groups.iter().enumerate() {if group.class_name == "BRACKET_TEXT"&& whitelists.group_names.contains(&normalize_whitelist_name(&group_text(tokens, group)))86 unmodified lineslet ep_markers = ["EP", "E", "Episode", "ep", "episode"];let roman = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];apply_known_title_phrases(tokens, groups, &mut output);if roles.first().is_some_and(|role| role.starts_with("EPISODE"))407 unmodified lines} else {String::new()};if previous_text.ends_with('第') && next_text.starts_with('期') {output[index] = "SEASON".to_string();continue;}if output[..index].iter().any(|role| role == "TITLE")&& (output[..index].iter()389 unmodified lines];let mut output = labels.to_vec();for (index, (token, label)) in tokens.iter().zip(labels.iter()).enumerate() {if label != "O" || !entity_joiners.contains(&token.as_str()) {continue;}675 unmodified lineslabels_for("[DVD] 鋼鉄天使くるみ 予告 第03話 30秒バージョン (640x480 WMV9)");assert!(preview_seconds.contains(&("03".to_string(), "B-EPISODE".to_string())));assert!(!preview_seconds.contains(&("30".to_string(), "B-EPISODE".to_string())));}}221 unmodified lines2222232242252262272281978 unmodified lines22072208220922102211221222132214221522162217221822192220222122229 unmodified lines22322233223422352236223722382239224022412242224322442245224686 unmodified lines2333233423352336233723382339234023412342234323442345234623472348234923502351235223532354407 unmodified lines27622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784389 unmodified lines3174317531763177317831793180318131823183318431853186318731883189319031913192675 unmodified lines386838693870387138723873387438753876387738783879388038813882388338843885388638873888221 unmodified linesRegex::new(r"(?i)^(?:CHS|CHT|ZHS|ZHT|GB|BIG5|JPN?|JP|JA|JAP|ENG|EN|SC|TC|简[体體]?|繁[体體]?|简日|繁日|字幕|内封|外挂|Sub|Subs|MSubs?)$").unwrap()});static MEDIA_RE: Lazy<Regex> = Lazy::new(|| {Regex::new(r"(?i)^(?:WEB|WEB[-_. ]?DL|WEB[-_. ]?Rip|BDRip|BluRay|BDMV|BD|DVDRip|DVD|HD|UHD|HDTV|TVRip|REMUX|xvid|x26[45]|h\.?26[45]|HEVC|AVC|AV1|YUV\d+P?\d*|AAC\s*\d*(?:\.\d+)?|DDP\s*\d*(?:\.\d+)?|FLAC|MP3|DTS|HDMA|DTS-HDMA|E?AC3x?\d*(?:\.\d+)?|Opus|WMV\d*|\d(?:\.\d)?ch|10[-_. ]?bit|8[-_. ]?bit|Hi10p?|Ma10p|ASSx?\d*|SRTx?\d*|SUP|R\d[A-Z]*|NoSub|MKV|MP4|AVI|RAW|Raws?)$").unwrap()});static SPECIAL_TITLE_PHRASE_RE: Lazy<Regex> = Lazy::new(|| {Regex::new(r"(?i)\b(?:theater\s+greeting\s+event|world\s+prem(?:eie|iere)|picture\s+drama)\b")1978 unmodified lines|| SPECIAL_TITLE_PHRASE_RE.is_match(text)}fn looks_like_release_group(text: &str) -> bool {let normalized = text.to_ascii_lowercase();normalized.contains("fansub")|| normalized.ends_with("sub")|| normalized.contains("sub&")|| normalized.contains("&sub")|| normalized.contains("字幕组")|| normalized.contains("字幕組")}const KNOWN_TITLE_PHRASES: &[&[&str]] = &[&["SPY", "x", "FAMILY"],&["Spy", "x", "Family"],9 unmodified linesfn apply_known_title_phrases(tokens: &[String], groups: &[Group], roles: &mut [String]) {if let Some(whitelists) = RUNTIME_WHITELISTS.get() {for (index, group) in groups.iter().enumerate() {let previous_structural = roles[..index].iter().any(|role| {role.starts_with("EPISODE")|| matches!(role.as_str(),"SEASON" | "SPECIAL" | "SOURCE" | "RESOLUTION")});if group.class_name == "BRACKET_TEXT"&& !previous_structural&& whitelists.group_names.contains(&normalize_whitelist_name(&group_text(tokens, group)))86 unmodified lineslet ep_markers = ["EP", "E", "Episode", "ep", "episode"];let roman = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];apply_known_title_phrases(tokens, groups, &mut output);if output.first().is_some_and(|role| role == "GROUP") {let first_text = group_text(tokens, &groups[0]);let first_is_known_group = RUNTIME_WHITELISTS.get().is_some_and(|whitelists| {whitelists.group_names.contains(&normalize_whitelist_name(&first_text))});if !first_is_known_group {if let Some(groupish_index) = (1..groups.len()).find(|&index| {output[index] == "TITLE" && looks_like_release_group(&group_text(tokens, &groups[index]))}) {output[0] = "TITLE".to_string();output[groupish_index] = "GROUP".to_string();}}}if roles.first().is_some_and(|role| role.starts_with("EPISODE"))407 unmodified lines} else {String::new()};let previous_real_text = (0..index).rev().find(|&cursor| groups[cursor].class_name != "SEP").map(|cursor| group_text(tokens, &groups[cursor])).unwrap_or_default();if previous_text.ends_with('第') && next_text.starts_with('期') {output[index] = "SEASON".to_string();continue;}if matches!(previous_real_text.to_ascii_lowercase().as_str(),"lesson" | "part"){output[index] = "O".to_string();continue;}if output[..index].iter().any(|role| role == "TITLE")&& (output[..index].iter()389 unmodified lines];let mut output = labels.to_vec();for (index, (token, label)) in tokens.iter().zip(labels.iter()).enumerate() {if label == "B-EPISODE" && token.chars().all(|ch| ch.is_ascii_digit()) {let previous_word = (0..index).rev().find(|&cursor| {!joiners.contains(&tokens[cursor].as_str()) && labels[cursor] != "O"|| tokens[cursor].chars().any(|ch| ch.is_alphabetic())}).map(|cursor| tokens[cursor].to_ascii_lowercase());if matches!(previous_word.as_deref(), Some("lesson" | "part")) {output[index] = "O".to_string();continue;}}if label != "O" || !entity_joiners.contains(&token.as_str()) {continue;}675 unmodified lineslabels_for("[DVD] 鋼鉄天使くるみ 予告 第03話 30秒バージョン (640x480 WMV9)");assert!(preview_seconds.contains(&("03".to_string(), "B-EPISODE".to_string())));assert!(!preview_seconds.contains(&("30".to_string(), "B-EPISODE".to_string())));let hi10_source =labels_for("[POPGO][Shigatsu wa Kimi no Uso] [01][Hi10][720P][GB][A964DA24]");assert!(hi10_source.contains(&("Hi10".to_string(), "B-SOURCE".to_string())));assert!(!hi10_source.contains(&("Hi10".to_string(), "B-GROUP".to_string())));let souten =labels_for("[苍天之拳].[Fosky_Fansub][Souten_No_Ken][DVDRIP][01][H.264_FLAC][848x480][CDD495FC]");assert!(souten.contains(&("Fosky".to_string(), "B-GROUP".to_string())));assert!(!souten.contains(&("苍天之拳".to_string(), "B-GROUP".to_string())));assert!(souten.contains(&("Souten".to_string(), "B-TITLE".to_string())));let bonjour =labels_for("(2014Q4) Bonjour♪恋味パティスリー 第01話 「Lesson 1」 (1280x720 x265 10bit AAC)");assert!(bonjour.contains(&("01".to_string(), "B-EPISODE".to_string())));assert!(!bonjour.contains(&("1".to_string(), "B-EPISODE".to_string())));}}
tools/rust_dmhy_template_apply/src/main.rs+77-1