0.108.11: Ring X correction included (built, not installed)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-05 16:17:07 +00:00
co-authored by Claude Opus 5.5
parent 4f4bfd3138
commit 80a37131ab
10 changed files with 6944 additions and 6 deletions
@@ -64,7 +64,8 @@ internal val Briefs: List<Brief> = listOf(
Brief(309, "BritX", setOf("Movie"), setOf("Crime", "Comedy", "Drama", "Thriller"),
themes = w("gangster", "gang", "criminal", "crime", "heist", "drug", "hooligan", "council estate", "thug", "con", "robbery", "dealer"),
against = w("documentary"), era = 1965 to 2026, uk = true, current = true, needTheme = true),
Brief(401, "Ring X", setOf("Movie", "Series"), setOf("Sport", "Action", "Documentary"), themes = w("wrestl", "WWE", "AEW", "TNA", "UFC", "MMA", "mixed martial", "title match", "pay-per-view", "bout"),
Brief(401, "Ring X", setOf("Movie", "Series"), setOf("Sport", "Action", "Documentary"), themes = w("wrestl", "WWE", "AEW", "TNA", "NJPW", "ROH", "Impact Wrestling", "NXT", "SmackDown", "WrestleMania", "Royal Rumble", "SummerSlam",
"Survivor Series", "Money in the Bank", "Bound for Glory", "WrestleDream", "title match", "pay-per-view"),
against = w("romance"), era = 1980 to 2026, current = true, needTheme = true),
Brief(601, "Vortex", setOf("Series", "Movie"), setOf("Animation", "Action", "Anime"), setOf("Animation", "Anime"),
w("anime", "fight", "power", "warrior", "battle", "hero", "martial", "saiyan", "ninja", "mecha", "demon"), w("preschool", "sitcom"), 1980 to 2026, needTheme = true),
@@ -91,6 +92,9 @@ private val EnglishCountries = Regex("United States|United Kingdom|Canada|Austra
private val ForeignBoard = Regex("^(SG|BR|PL|KR|JP|DE|FR|IT|ES|NL|TR|IN|MX|CN|HK|TW|TH|PH|MY|ID|RU|SE|NO|DK|FI|AR|CL|CO|PT|CZ|HU|RO|GR|IL|EG|SA|AE|VN)-", RegexOption.IGNORE_CASE)
/** Mainstream audience ratings: a horror-comedy rated these (or for children) keeps its usual channels. */
private val MainstreamRatings = setOf("PG-13", "12", "12A", "TV-14", "GB-12", "GB-12A", "GB-15", "15")
/** Paul, 5 November 2026: Ring X is professional wrestling. A verified promotion, by studio, counts for it; MMA events go on no channel. */
private val WrestlingPromotion = Regex("\\b(WWE|World Wrestling|All Elite Wrestling|AEW|TNA|Total Nonstop|Impact Wrestling|New Japan|NJPW|Ring of Honor|ROH|NWA|WCW|ECW|Lucha|Stardom|Game Changer Wrestling)\\b", RegexOption.IGNORE_CASE)
private val MmaEvent = Regex("\\b(UFC|MMA|mixed martial|Bellator|PFL|Ultimate Fighting|cage (fight|bout)|octagon)", RegexOption.IGNORE_CASE)
private val HorrorComedy = Regex("\\b(body horror|body-horror|gross-out|splatter|horror-comedy|horror comedy)", RegexOption.IGNORE_CASE)
private val LiveSpecial = Regex("\\b(stand-up|standup|comedian|comedy special|unruly set|in this set|live from|in concert|tour film|takes aim at)\\b", RegexOption.IGNORE_CASE)
private val EventFilmWords = Regex("superhero|epic|franchise|saga|blockbuster", RegexOption.IGNORE_CASE)
@@ -179,6 +183,8 @@ internal fun channelScore(e: TitleEvidence, b: Brief, text: ChannelText, links:
val ev = mutableListOf<String>(); val g = e.genreSet; val ov = e.overview.orEmpty(); val rating = e.rating.orEmpty(); val ch = b.number
val all = ov + " " + e.name + " " + e.taglines.orEmpty().joinToString(" ")
if (e.type !in b.kinds) return 0.0 to listOf("wrong kind")
val withStudios = listOf(e.name, ov, e.studios.orEmpty().joinToString(" ")).joinToString(" ")
if (MmaEvent.containsMatchIn(withStudios) && !WrestlingPromotion.containsMatchIn(withStudios)) return 0.0 to listOf("an MMA event: Ring X is professional wrestling, and no channel takes MMA events")
if (b.kids && rating in Adult) return 0.0 to listOf("rated $rating")
var s = 0.0
val animated = "Animation" in g; val doc = "Documentary" in g
@@ -223,6 +229,7 @@ internal fun channelScore(e: TitleEvidence, b: Brief, text: ChannelText, links:
}
if (b.kids && rating.isNotEmpty() && rating !in KidsOk) { s *= .5; ev += "rated $rating" }
if (b.kids && rating.isEmpty()) { s *= .8; ev += "no rating to confirm it suits children" }
if (ch == 401 && WrestlingPromotion.containsMatchIn(e.studios.orEmpty().joinToString(" "))) { s += .15; ev += "a verified wrestling promotion" }
if ("Horror" in g && (ch == 304 || ch == 305)) { s += .12; ev += "a horror film" }
if ("Horror" in g && ch in setOf(308, 307, 612, 613)) { s *= .5; ev += "horror is not for this channel" }
if (horrorComedy && ch == 305) { s += .15; ev += "a horror-comedy, After Dark's cult territory" }
@@ -31,6 +31,19 @@ class ChairLearningTest {
assertNull(lessons.holdBackFor(401, wrestling, setOf(lesson.key)))
}
@Test fun ringXIsWrestlingAndMmaEventsHaveNoChannel() {
// Paul's correction, 5 November 2026.
val text = ChannelText(emptyMap(), mapOf("u" to ufc))
assertTrue(Briefs.all { channelScore(ufc, it, text).first == 0.0 })
assertTrue(channelScore(ufc, Briefs.first { it.number == 401 }, text).second.single().contains("MMA event"))
// A strawweight bout isn't WWE: the promotion is matched as a whole word.
val straw = ev("s", "UFC Fight Night 289", listOf("Action"), "A women's strawweight final, a mixed martial arts event.")
assertEquals(0.0, channelScore(straw, Briefs.first { it.number == 401 }, text).first, 0.0)
val wwe = ev("w", "Survivor Series: WarGames", listOf("Action", "Sport"), "Survivor Series: the WarGames pay-per-view.", listOf("WWE"))
val ringX = channelScore(wwe, Briefs.first { it.number == 401 }, ChannelText(emptyMap(), mapOf("w" to wwe)))
assertTrue(ringX.first > .45); assertTrue(ringX.second.any { "verified wrestling promotion" in it })
}
@Test fun aBroadGenreNeedsThreeAndASpecificReasonWins() {
val e = mapOf("1" to ev("1", "Wedding One", listOf("Romance", "Musical")), "2" to ev("2", "Wedding Two", listOf("Romance", "Musical")), "3" to ev("3", "Wedding Three", listOf("Romance", "Musical")))
assertTrue(chairLessons(listOf(dropped("1", "Wedding One", 307), dropped("2", "Wedding Two", 307)), e).lessons.isEmpty()) // two by genre: not enough
@@ -44,11 +57,11 @@ class ChairLearningTest {
val line = { id: String, name: String, ov: String -> JSONObject().put("id", id).put("type", "Movie").put("name", name).put("year", 2026)
.put("overview", ov).put("genres", JSONArray(listOf("Action", "Sport"))).put("studios", JSONObject.NULL)
.put("rating", JSONObject.NULL).put("countries", JSONArray(listOf("United States"))).put("taglines", JSONObject.NULL) }
val evidence = File.createTempFile("evidence", ".jsonl").apply { deleteOnExit(); writeText(listOf(line("1", "UFC 330", "A UFC mixed martial arts pay-per-view event with a title bout."),
line("2", "UFC 331", "A UFC mixed martial arts pay-per-view event with a title bout."), line("9", "UFC 334", "A UFC mixed martial arts pay-per-view event with a title bout.")).joinToString("") { "$it\n" }) }
val evidence = File.createTempFile("evidence", ".jsonl").apply { deleteOnExit(); writeText(listOf(line("1", "Fight Night 1", "A boxing pay-per-view title match between two heavyweight champions."),
line("2", "Fight Night 2", "A boxing pay-per-view title match between two heavyweight champions."), line("9", "Fight Night 9", "A boxing pay-per-view title match between two heavyweight champions.")).joinToString("") { "$it\n" }) }
val sets = File.createTempFile("collections", ".jsonl").apply { delete(); deleteOnExit() }
val history = listOf(dropped("1", "UFC 330", 401), dropped("2", "UFC 331", 401))
fun report(state: LearningState) = buildDeskReport(evidence, sets, emptyMap(), listOf(Arrival("9", "Movie", "UFC 334", 2026, "2026-10-30", "tmdb:9", 0)),
val history = listOf(dropped("1", "Fight Night 1", 401), dropped("2", "Fight Night 2", 401))
fun report(state: LearningState) = buildDeskReport(evidence, sets, emptyMap(), listOf(Arrival("9", "Movie", "Fight Night 9", 2026, "2026-10-30", "tmdb:9", 0)),
emptySet(), emptyMap(), 1, true, DirectorMode.Balanced, 1_793_800_000_000, decided = setOf("1", "2"), history = history, learning = state)
fun shown(r: DeskReport) = (r.picks.map { it.id } + r.asks.map { it.id }).contains("9")
val proposed = report(LearningState(on = true))