//! The news filter, measured against real headlines. //! //! Every case here was taken from a live Google News feed for one of Kyle's //! followed artists on 2026-08-05, and hand-labelled. The four `reject_*` //! cases are the ones he reported. Treat these numbers as tuning-set //! performance: the weights were chosen with this corpus in view, so a new //! bug report should arrive as a new row here rather than as a tweak to a //! weight that is already fitted. use metadata::{news_relevance, news_tier, ArtistNewsItem, NewsTier}; fn item(title: &str, host: &str) -> ArtistNewsItem { ArtistNewsItem { title: title.to_string(), url: String::new(), source: String::new(), date: 1_785_000_000, host: host.to_string(), others: 0, } } fn keeps(title: &str, host: &str, artist: &str) -> bool { news_relevance(&item(title, host), artist, news_tier(artist)).is_some() } #[test] fn tiers_are_assigned_by_dictionary_not_by_length() { // "Weezer" is six characters and perfectly safe; deciding riskiness by // length demoted it to the strict path and cost four genuine items. assert_eq!(news_tier("Weezer"), NewsTier::Single); assert_eq!(news_tier("Wand"), NewsTier::Single); assert_eq!(news_tier("toe"), NewsTier::VeryCommon); assert_eq!(news_tier("Pond"), NewsTier::VeryCommon); assert_eq!(news_tier("King Gizzard & The Lizard Wizard"), NewsTier::Distinctive); assert_eq!(news_tier("Camping In Alaska"), NewsTier::Distinctive); } // ---------------------------------------------------------------- rejects #[test] fn rejects_hyphenated_compounds() { // Hard gate 2 — every occurrence abuts a hyphen. assert!(!keeps( "Charli XCX Launches Her 'Music, Fashion, Film' Era in Patent Peep-toe Mules", "wwd.com", "toe", )); assert!(!keeps( "Hyperpop standout Underscores makes music that can go toe-to-toe with the biggest pop acts", "chicagoreader.com", "toe", )); assert!(!keeps( "The Toe-Tapping Music Genres You're Most Likely To Hear In Trader Joe's", "chowhound.com", "toe", )); } #[test] fn rejects_the_stellar_blade_case() { // The occurrence floor earning its keep: this has a music noun and a // quoted title, so document-level signals alone would have passed it. assert!(!keeps( "Stellar Blade: Blood Rain studio CEO defends AI music video because Evie was originally \"created from head to toe\" by the devs", "gamesradar.com", "toe", )); } #[test] fn rejects_the_obituary() { assert!(!keeps( "Obituary information for Amanda M. Pond", "cody-whitefuneralhome.com", "Pond", )); } #[test] fn rejects_places_and_surnames() { for (title, host) in [ ("Rock the Dock 2026 bringing live music to Goose Pond Colony", "rocketcitynow.com"), ("Jud Caswell in Round Pond", "lcnme.com"), ("Bird Song Project sculpture trail opens at Inlet Pond County Park", "northforksun.com"), ("On the record with Aaron Pond and the People's Music Supply", "broadstreetreview.com"), ("Miami Music Week at Toe Jam Backlot", "timeout.com"), ] { let artist = if title.contains("Toe") { "toe" } else { "Pond" }; assert!(!keeps(title, host, artist), "should have rejected: {title}"); } } // ------------------------------------------------------------------ keeps #[test] fn keeps_genuine_items_for_a_very_common_name() { assert!(keeps("toe Announces October Shows in Osaka and Tokyo", "niew.jp", "toe")); assert!(keeps("Pond Announce New Album 'Terrestrials'", "diymag.com", "Pond")); assert!(keeps("Ride Announce Here And Now Tour For 2027", "nme.com", "Ride")); } #[test] fn keeps_a_bare_tour_announcement_with_no_music_vocabulary() { // The false-negative the brief demands: strict enough to kill Stellar // Blade must not kill this. assert!(keeps("Weezer Announces 'The Gathering' Fall Tour", "rockcellarmagazine.com", "Weezer")); } #[test] fn keeps_the_short_form_and_the_possessive() { // Without the 4+-token short-form variant and the possessive-tolerant // gate these silently vanish. assert!(keeps( "King Gizzard's Stu Mackenzie on leaving Spotify", "pitchfork.com", "King Gizzard & The Lizard Wizard", )); assert!(keeps( "King Gizzard and The Lizard Wizard debut \"Alien Metal\"", "northerntransmissions.com", "King Gizzard & The Lizard Wizard", )); } #[test] fn keeps_masthead_and_review_conventions() { assert!(keeps("Review: toe, 'NOW I SEE THE LIGHT'", "thequietus.com", "toe")); assert!(keeps("Pond 'Terrestrials' Review", "clashmusic.com", "Pond")); } #[test] fn a_music_press_host_alone_never_admits_an_item() { // "Every song on the 'Tip Toe' soundtrack" is a music-press host plus a // quoted work title plus a music noun, and zero evidence at the name. assert!(!keeps("Every song on the 'Tip Toe' soundtrack", "nme.com", "toe")); }