Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

fix(render): pluralize footer nouns ending in consonant+y (#1261)

Matt Van Horn66421075631e
diff --git a/changelog.d/+footer-stories-plural.fixed.md b/changelog.d/+footer-stories-plural.fixed.md
new file mode 100644
index 00000000..79538dc2
--- /dev/null
+++ b/changelog.d/+footer-stories-plural.fixed.md
@@ -0,0 +1 @@
+Fixed the engine footer printing "15 storys" for Hacker News; it now reads "15 stories" (and "1 story"). Footer nouns ending in a consonant followed by "y" now pluralize to "ies".
diff --git a/skills/last30days/scripts/lib/render.py b/skills/last30days/scripts/lib/render.py
index e2fe253e..29911f79 100644
--- a/skills/last30days/scripts/lib/render.py
+++ b/skills/last30days/scripts/lib/render.py
@@ -2909,7 +2909,12 @@ def _footer_line_for_source(
emoji: str, label: str, count: int, item_word: str, stats: str
) -> str:
count_str = f"{count:,}" if count >= 1000 else str(count)
- plural = f"{item_word}s" if count != 1 else item_word
+ if count == 1:
+ plural = item_word
+ elif len(item_word) > 1 and item_word.endswith("y") and item_word[-2] not in "aeiou":
+ plural = f"{item_word[:-1]}ies"
+ else:
+ plural = f"{item_word}s"
if stats:
return f"{emoji} {label}: {count_str} {plural} │ {stats}"
return f"{emoji} {label}: {count_str} {plural}"
diff --git a/tests/test_render_v3.py b/tests/test_render_v3.py
index 34cf1114..0ad639b1 100644
--- a/tests/test_render_v3.py
+++ b/tests/test_render_v3.py
@@ -1782,3 +1782,37 @@ class TestSourceUrlsAreClickable(unittest.TestCase):
text = "\n".join(render._render_candidate(candidate, "1."))
self.assertNotIn("\n## forged heading", text)
self.assertNotIn("URL: [", text)
+
+
+class FooterPluralizationTests(unittest.TestCase):
+ def test_story_pluralizes_to_stories(self):
+ self.assertEqual(
+ render._footer_line_for_source("🟡", "HN", 15, "story", ""),
+ "🟡 HN: 15 stories",
+ )
+ self.assertEqual(
+ render._footer_line_for_source("🟡", "HN", 1, "story", ""),
+ "🟡 HN: 1 story",
+ )
+
+ def test_regular_nouns_keep_plain_s(self):
+ self.assertEqual(
+ render._footer_line_for_source("🟠", "Reddit", 2, "thread", "5 upvotes"),
+ "🟠 Reddit: 2 threads │ 5 upvotes",
+ )
+ self.assertEqual(
+ render._footer_line_for_source("🔵", "X", 1, "post", ""),
+ "🔵 X: 1 post",
+ )
+ self.assertEqual(
+ render._footer_line_for_source("🔴", "YouTube", 0, "video", ""),
+ "🔴 YouTube: 0 videos",
+ )
+
+ def test_every_footer_noun_pluralizes_sanely(self):
+ for _key, _emoji, _label, noun, _eng in render._FOOTER_SOURCES:
+ plural = render._footer_line_for_source("x", "L", 2, noun, "").split("2 ", 1)[1]
+ if noun.endswith("y") and noun[-2] not in "aeiou":
+ self.assertEqual(plural, noun[:-1] + "ies")
+ else:
+ self.assertEqual(plural, noun + "s")