fix(parse): close title on spelled-out season ranges

This commit is contained in:
Miguel Palhas
2026-08-23 18:12:47 +01:00
parent e4c49b75de
commit 4f848c27f0
2 changed files with 44 additions and 0 deletions
+8
View File
@@ -55,11 +55,19 @@ pub(crate) fn classify_pair(a: &str, b: &str) -> Option<(Marker, Strength)> {
("season", n) if !n.is_empty() && n.bytes().all(|c| c.is_ascii_digit()) => {
(Marker::Junk, Strength::Strong)
}
("seasons", n) if is_season_count(n) => (Marker::Junk, Strength::Strong),
_ => return None,
};
Some(m)
}
/// `1`, `1-3`: the count after a spelled-out `Seasons`. Each part is 1-2
/// digits so a trailing year (`Four Seasons 2024`) never reads as a count.
fn is_season_count(n: &str) -> bool {
n.split('-')
.all(|part| (1..=2).contains(&part.len()) && part.bytes().all(|b| b.is_ascii_digit()))
}
#[allow(clippy::too_many_lines)]
fn classify_exact(t: &str) -> Option<(Marker, Strength)> {
use Strength::{Strong, Weak};