The Chair reads "Sci-Fi" as science fiction

434 of the library's films carry only the "Sci-Fi" tag; the Chair took them for not
science fiction, so Orbit Sci-Fi could never be suggested for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 15:38:06 +00:00
co-authored by Claude Opus 5.5
parent d953b961fa
commit da1f203071
3 changed files with 11 additions and 1 deletions
@@ -193,6 +193,7 @@ internal fun rotationReport(store: ScheduleStore, catalogue: CatalogueStore, use
// had none read, so blocks had no known rating and nothing could be judged). A description, when there is one, still wins.
val briefs = BaseBriefs + customBriefs
val wantedGenres = briefs.filter { b -> blocks.any { it.channel == b.number } }.flatMap { it.genresAny }
.let { g -> g + GenreSynonyms.filterValues { it in g }.keys } // the library's own spellings too, such as "Sci-Fi"
val catalogued = runCatching { catalogue.shapeRows(pools.values.flatten().filter { it.isFilm && it.id !in read }.map { it.id }) + catalogue.ratedFilmsIn(wantedGenres, ROTATION_CATALOGUE_FILMS) }
.getOrDefault(emptyList()).associate { r -> r.id to TitleEvidence(r.id, r.type, r.title, r.year, null, r.genres.toList(), null, r.rating.ifBlank { null }, null, null) }
val evidence = catalogued + read
@@ -110,7 +110,8 @@ internal val BaseBriefs: List<Brief> = listOf(
internal val KidsOk = setOf("G", "PG", "TV-Y", "TV-Y7", "TV-G", "TV-PG", "U", "TV-Y7-FV", "E", "0+", "3+", "6+", "7+")
internal val Adult = setOf("R", "TV-MA", "NC-17", "18", "18+", "X", "NR18", "SG-R21", "SG-M18", "GB-18")
internal val GenreSynonyms = mapOf("Anime" to "Animation", "Martial Arts" to "Action", "Sci-Fi & Fantasy" to "Science Fiction", "Action & Adventure" to "Action",
// "Sci-Fi" (Paul, 23 November 2026): 434 of the library's films carry only that tag, and the Chair took them for not science fiction.
internal val GenreSynonyms = mapOf("Anime" to "Animation", "Martial Arts" to "Action", "Sci-Fi & Fantasy" to "Science Fiction", "Sci-Fi" to "Science Fiction", "Action & Adventure" to "Action",
"Kids" to "Children", "Suspense" to "Thriller", "Sports" to "Sport")
private val Uk = Regex("United Kingdom|England|Scotland|Wales|\\bUK\\b")
private val UkStudio = Regex("\\bBBC\\b|\\bITV\\b|Channel 4|Film4|Sky\\b|Working Title|Ealing|Hammer|Aardman", RegexOption.IGNORE_CASE)
@@ -48,4 +48,12 @@ class PixelzWonderTest {
assertTrue(it in pixelzList); assertFalse(it in wonderList)
}
}
@Test fun aFilmTaggedSciFiIsScienceFictionToTheChair() {
val e = TitleEvidence.of(JSONObject().put("id", "s").put("type", "Movie").put("name", "Star Run").put("year", 1991)
.put("overview", "A robot from the future travels back in time to protect a boy on a distant planet.").put("genres", JSONArray(listOf("Action", "Sci-Fi")))
.put("studios", JSONObject.NULL).put("rating", "15").put("countries", JSONObject.NULL).put("taglines", JSONObject.NULL))
assertTrue("Science Fiction" in e.genreSet)
assertTrue(channelScore(e, Briefs.first { it.number == 303 }, ChannelText(emptyMap(), mapOf("s" to e))).first > 0)
}
}