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
Refine high-frequency DMHY labels
Browse files202 unmodified lines20320420520620720810 unmodified lines219220221222223224225984 unmodified lines121012111212121312141215121614 unmodified lines123112321233123412351236123712381853 unmodified lines309230933094309530963097155 unmodified lines32533254325532563257325816 unmodified lines3275327632773278327932803281328232833284328532863287272 unmodified lines35603561356235633564356535663567356835693570357135723573438 unmodified lines40124013401440154016202 unmodified lines});static ASCII_SEASON_SUFFIX_RE: Lazy<Regex> =Lazy::new(|| Regex::new(r"(?i)^(.+?)[\s_.-]+(S\d{1,2})$").unwrap());static CJK_TITLE_LANG_PREFIX_RE: Lazy<Regex> =Lazy::new(|| Regex::new(r"^(.+?)(国日双语|國日雙語|日语版|日語版|国语版|國語版|双语|雙語)(第?)$").unwrap());static SEASON_VALUE_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)^S(\d{1,2})$").unwrap());10 unmodified linesstatic CJK_DATE_RE: Lazy<Regex> =Lazy::new(|| Regex::new(r"^(?:19|20)\d{2}年\d{1,2}月\d{1,2}日$").unwrap());static LANG_RE: Lazy<Regex> = Lazy::new(|| {Regex::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()984 unmodified lines}}};if recipe.count.unwrap_or(0) <= args.audit_max_count && has_blocking_low_frequency_warning(&record){return Processed::Skipped {reason: "low_frequency_audit_warning",14 unmodified lines}}fn has_blocking_low_frequency_warning(record: &Record) -> bool {audit_warnings(record).iter().any(|warning| {matches!(warning.as_str(),"ambiguous_no_episode_title"1853 unmodified lines.is_some_and(|ch| ch.is_whitespace() || !ch.is_alphanumeric())}fn split_cjk_title_lang_prefix(token: &str) -> Option<(Vec<String>, Vec<String>)> {let caps = CJK_TITLE_LANG_PREFIX_RE.captures(token)?;let title = caps.get(1)?.as_str();155 unmodified linescontinue;}}if label == "B-EPISODE" && token.chars().all(|ch| ch.is_ascii_digit()) {let previous_non_space = (0..index).rev()16 unmodified linescontinue;}}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" | "no")) {output[index] = "O".to_string();continue;272 unmodified lineslet bang_season =labels_for("[LoliHouse] Bang Dream! 2nd Season - 01 [BDRip 1080p HEVC-10bit FLAC]");assert!(bang_season.contains(&("Bang".to_string(), "B-TITLE".to_string())));assert!(bang_season.contains(&("Season".to_string(), "B-TITLE".to_string())));assert!(bang_season.contains(&("01".to_string(), "B-EPISODE".to_string())));assert!(!bang_season.contains(&("01".to_string(), "B-SEASON".to_string())));let basket =labels_for("[Nekomoe kissaten&VCB-Studio] Fruits Basket 1st Season [24][1080p][x264_aac][sc]");assert!(basket.contains(&("Fruits".to_string(), "B-TITLE".to_string())));assert!(basket.contains(&("Season".to_string(), "B-TITLE".to_string())));assert!(basket.contains(&("24".to_string(), "B-EPISODE".to_string())));assert!(!basket.contains(&("24".to_string(), "B-SEASON".to_string())));438 unmodified lineslet bilingual = labels_for("辉夜大小姐想让我告白~天才们的恋爱头脑战~.S2-01.中日双语.云光字幕组.[1080p]");assert!(bilingual.contains(&("中日".to_string(), "B-SOURCE".to_string())));assert!(!bilingual.contains(&("中日".to_string(), "B-TITLE".to_string())));}}202 unmodified lines20320420520620720820921021121210 unmodified lines223224225226227228229984 unmodified lines121412151216121712181219122012211222122314 unmodified lines123812391240124112421243124412451853 unmodified lines3099310031013102310331043105310631073108310931103111155 unmodified lines326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333616 unmodified lines3353335433553356335733583359336033613362336333643365336633673368336933703371272 unmodified lines3644364536463647364836493650365136523653365436553656365736583659438 unmodified lines4098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149202 unmodified lines});static ASCII_SEASON_SUFFIX_RE: Lazy<Regex> =Lazy::new(|| Regex::new(r"(?i)^(.+?)[\s_.-]+(S\d{1,2})$").unwrap());static ORDINAL_SEASON_TOKEN_RE: Lazy<Regex> =Lazy::new(|| Regex::new(r"(?i)^\d{1,2}(?:st|nd|rd|th)$").unwrap());static SEASON_WORD_RE: Lazy<Regex> =Lazy::new(|| Regex::new(r"(?i)^(?:Season|Saison)$").unwrap());static CJK_TITLE_LANG_PREFIX_RE: Lazy<Regex> =Lazy::new(|| Regex::new(r"^(.+?)(国日双语|國日雙語|日语版|日語版|国语版|國語版|双语|雙語)(第?)$").unwrap());static SEASON_VALUE_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)^S(\d{1,2})$").unwrap());10 unmodified linesstatic CJK_DATE_RE: Lazy<Regex> =Lazy::new(|| Regex::new(r"^(?:19|20)\d{2}年\d{1,2}月\d{1,2}日$").unwrap());static LANG_RE: Lazy<Regex> = Lazy::new(|| {Regex::new(r"(?i)^(?:CHS|CHT|ZHS|ZHT|GB|BIG5|JPN?|JP|JA|JAP|JPTC|JPSC|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()984 unmodified lines}}};let warnings = audit_warnings(&record);if warnings.iter().any(|warning| warning == "no_title")|| (recipe.count.unwrap_or(0) <= args.audit_max_count&& has_blocking_warnings(&warnings)){return Processed::Skipped {reason: "low_frequency_audit_warning",14 unmodified lines}}fn has_blocking_warnings(warnings: &[String]) -> bool {warnings.iter().any(|warning| {matches!(warning.as_str(),"ambiguous_no_episode_title"1853 unmodified lines.is_some_and(|ch| ch.is_whitespace() || !ch.is_alphanumeric())}fn is_unicode_roman_season(token: &str) -> bool {matches!(token,"Ⅰ" | "Ⅱ" | "Ⅲ" | "Ⅳ" | "Ⅴ" | "Ⅵ" | "Ⅶ" | "Ⅷ" | "Ⅸ" | "Ⅹ" | "Ⅺ" | "Ⅻ")}fn split_cjk_title_lang_prefix(token: &str) -> Option<(Vec<String>, Vec<String>)> {let caps = CJK_TITLE_LANG_PREFIX_RE.captures(token)?;let title = caps.get(1)?.as_str();155 unmodified linescontinue;}}if label == "B-TITLE" && matches!(token.to_ascii_lowercase().as_str(), "ep" | "episode") {let next_episode = (index + 1..tokens.len()).find(|&cursor| {!joiners.contains(&tokens[cursor].as_str()) || labels[cursor] != "O"});if next_episode.is_some_and(|cursor| labels[cursor] == "B-EPISODE") {output[index] = "O".to_string();continue;}}if label == "B-TITLE" && is_unicode_roman_season(token) {let previous_title_word = (0..index).rev().find(|&cursor| {output[cursor] == "B-TITLE"&& tokens[cursor].chars().any(|ch| ch.is_alphanumeric() || ('\u{4e00}'..='\u{9fff}').contains(&ch))});let previous_word = previous_title_word.map(|cursor| tokens[cursor].to_ascii_lowercase());if previous_title_word.is_some()&& !matches!(previous_word.as_deref(), Some("lupin")){output[index] = "B-SEASON".to_string();continue;}}if label == "B-TITLE" && ORDINAL_SEASON_TOKEN_RE.is_match(token) {let next_word = (index + 1..tokens.len()).find(|&cursor| {!joiners.contains(&tokens[cursor].as_str())&& tokens[cursor].chars().any(|ch| ch.is_alphabetic())});if next_word.is_some_and(|cursor| {labels[cursor] == "B-TITLE" && SEASON_WORD_RE.is_match(&tokens[cursor])}) {output[index] = "B-SEASON".to_string();if let Some(cursor) = next_word {for joiner_index in index + 1..cursor {if joiners.contains(&tokens[joiner_index].as_str()) {output[joiner_index] = "B-SEASON".to_string();}}output[cursor] = "B-SEASON".to_string();}continue;}}if label == "O"&& token.chars().all(|ch| ch.is_ascii_digit())&& token.len() <= 3{let previous_non_space = (0..index).rev().find(|&cursor| !tokens[cursor].chars().all(char::is_whitespace));let next_non_space = (index + 1..tokens.len()).find(|&cursor| !tokens[cursor].chars().all(char::is_whitespace));if previous_non_space.is_some_and(|cursor| tokens[cursor] == "[")&& next_non_space.is_some_and(|cursor| tokens[cursor] == "]")&& output[..index].iter().any(|label| label == "B-TITLE")&& output[index + 1..].iter().any(|label| matches!(label.as_str(), "B-SOURCE" | "B-RESOLUTION")){output[index] = "B-EPISODE".to_string();continue;}}if label == "B-EPISODE" && token.chars().all(|ch| ch.is_ascii_digit()) {let previous_non_space = (0..index).rev()16 unmodified linescontinue;}}let mut previous_word = None;for cursor in (0..index).rev() {if matches!(tokens[cursor].as_str(), "]" | "】" | ")" | ")") {break;}if joiners.contains(&tokens[cursor].as_str()) {continue;}if tokens[cursor].chars().any(|ch| ch.is_alphabetic()) {previous_word = Some(tokens[cursor].to_ascii_lowercase());}break;}if matches!(previous_word.as_deref(), Some("lesson" | "part" | "no")) {output[index] = "O".to_string();continue;272 unmodified lineslet bang_season =labels_for("[LoliHouse] Bang Dream! 2nd Season - 01 [BDRip 1080p HEVC-10bit FLAC]");assert!(bang_season.contains(&("Bang".to_string(), "B-TITLE".to_string())));assert!(bang_season.contains(&("2nd".to_string(), "B-SEASON".to_string())));assert!(bang_season.contains(&("Season".to_string(), "B-SEASON".to_string())));assert!(bang_season.contains(&("01".to_string(), "B-EPISODE".to_string())));assert!(!bang_season.contains(&("01".to_string(), "B-SEASON".to_string())));let basket =labels_for("[Nekomoe kissaten&VCB-Studio] Fruits Basket 1st Season [24][1080p][x264_aac][sc]");assert!(basket.contains(&("Fruits".to_string(), "B-TITLE".to_string())));assert!(basket.contains(&("1st".to_string(), "B-SEASON".to_string())));assert!(basket.contains(&("Season".to_string(), "B-SEASON".to_string())));assert!(basket.contains(&("24".to_string(), "B-EPISODE".to_string())));assert!(!basket.contains(&("24".to_string(), "B-SEASON".to_string())));438 unmodified lineslet bilingual = labels_for("辉夜大小姐想让我告白~天才们的恋爱头脑战~.S2-01.中日双语.云光字幕组.[1080p]");assert!(bilingual.contains(&("中日".to_string(), "B-SOURCE".to_string())));assert!(!bilingual.contains(&("中日".to_string(), "B-TITLE".to_string())));let nekomoe_lang = labels_for("[Nekomoe kissaten][UniteUp!][05][720p][JPTC]");assert!(nekomoe_lang.contains(&("JPTC".to_string(), "B-SOURCE".to_string())));assert!(!nekomoe_lang.contains(&("JPTC".to_string(), "B-TITLE".to_string())));let hayate =labels_for("[漏勺rip][Hayate_the_combat_butler_2nd_Season][23][BDrip X264 AAC 720P]");assert!(hayate.contains(&("Hayate".to_string(), "B-TITLE".to_string())));assert!(hayate.contains(&("2nd".to_string(), "B-SEASON".to_string())));assert!(hayate.contains(&("Season".to_string(), "B-SEASON".to_string())));assert!(hayate.contains(&("23".to_string(), "B-EPISODE".to_string())));let jade = labels_for("[GM-Team][国漫][诛仙 第2季][Jade Dynasty ��][2024][12][AVC][GB][1080P]");assert!(jade.contains(&("Jade".to_string(), "B-TITLE".to_string())));assert!(jade.contains(&("Dynasty".to_string(), "B-TITLE".to_string())));assert!(jade.contains(&("Ⅱ".to_string(), "B-SEASON".to_string())));assert!(jade.contains(&("12".to_string(), "B-EPISODE".to_string())));let yu_no = labels_for("[JYFanSub][Kono_Yo_no_Hate_de_Koi_wo_Utau_Shoujo_YU-NO][23][BIG5][720P][AVC]",);assert!(yu_no.contains(&("NO".to_string(), "B-TITLE".to_string())));assert!(yu_no.contains(&("23".to_string(), "B-EPISODE".to_string())));let fox = labels_for("[GM-Team][国漫][狐妖小红娘 尾生篇][Fox Spirit Matchmaker Ⅷ][2019][05][AVC][GB][1080P]",);assert!(fox.contains(&("Fox".to_string(), "B-TITLE".to_string())));assert!(fox.contains(&("Ⅷ".to_string(), "B-SEASON".to_string())));let kage = labels_for("[LKSUB][Kage no Jitsuryokusha ni Naritakute! 2nd Season][03][GB][720P]");assert!(kage.contains(&("2nd".to_string(), "B-SEASON".to_string())));assert!(kage.contains(&(" ".to_string(), "B-SEASON".to_string())));assert!(kage.contains(&("Season".to_string(), "B-SEASON".to_string())));let tiger = labels_for("[虎面人W][Tiger Mask W][01][简日][720p]");assert!(tiger.contains(&("Tiger".to_string(), "B-TITLE".to_string())));assert!(tiger.contains(&("W".to_string(), "B-TITLE".to_string())));assert!(tiger.contains(&("01".to_string(), "B-EPISODE".to_string())));let date_live_special =labels_for("[ANK-Raws] デート・ア・ライブⅡ CM01 (BDrip 1920x1080 HEVC-YUV420P10 FLAC)");assert!(date_live_special.contains(&("Ⅱ".to_string(), "B-SEASON".to_string())));assert!(date_live_special.contains(&("CM01".to_string(), "B-SPECIAL".to_string())));let ep_only = dmhy_record("Ep.25", "tpl_test", &suggested_roles("TEXT SEP EPISODE")).unwrap();assert!(audit_warnings(&ep_only).contains(&"no_title".to_string()));}}
tools/rust_dmhy_template_apply/src/main.rs+146-13