fix(parse): close title on spelled-out season ranges
This commit is contained in:
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user