Forked from Forthena (PERSONAL/forthena) and retargeted: - NO login, NO LLM: the edition is public and the ranking is deterministic (stories that name Sen. BAM lead; freshest first) — Daniel: no like/dislike or store profile for visitors. - Crawler scoped to BAM: Bing news keyword queries + Inquirer/Rappler fallback wires, with a two-tier relevance gate (named-BAM always; Aquino+legislative-context only from fallback) so op-eds and non-Bam senators are dropped. - Desks: BAM (lead), Gaming, Education, Politics, Energy, PH, Business. - Community board /board: 'Thank you Senator BAM' — nickname-only posts, HTML-stripped, URL-only rejected, IP rate-limited (3/10min, 20/day). - Yellow-gamer theme (Orbitron/Rajdhani/JetBrains Mono, dark + gold, HUD corners), supporter disclaimer in header and footer. - Tests: category/date/relevance/text suites + Mongo board suite + full HTTP e2e (all passing). Infra: 66.181.46.132 (bidaangmamamayan.com), local Mongo 7.0, nginx + certbot TLS, PM2 bama (:3000) + 15-min crawl cron.
42 lines
2.2 KiB
JavaScript
42 lines
2.2 KiB
JavaScript
// The relevance gate — the heart of the tribute site.
|
|
// A story only prints if it names Sen. BAM Aquino (query jobs) or carries an
|
|
// Aquino surname in a senate context (native fallback wires).
|
|
import { bamRelevance } from "../lib/crawl.js";
|
|
|
|
let fails = 0;
|
|
const check = (name, cond, detail = "") => {
|
|
console.log(` ${cond ? "ok " : "FAIL"} ${name}${detail ? " — " + detail : ""}`);
|
|
if (!cond) fails++;
|
|
};
|
|
|
|
const g = (t, d = "") => bamRelevance(t, d);
|
|
|
|
console.log("named BAM (admitted):");
|
|
check("full name", g("Sen. Bam Aquino backs power inquiry").named);
|
|
check("Bam Aquino", g("Bam Aquino opens gaming center in Pampanga").named);
|
|
check("Bam Aquino (A.)", g("Bam A. Aquino speaks in senate").named);
|
|
check("Senator Bam", g("Senator Bam pushes scholarship bill").named);
|
|
check("description names him", g("Senate votes on terms", "Senator Bam Aquino voted in favor of the measure.").named);
|
|
check("proximity Bam...Aquino", g("Aquino clan senator", "Bam joined the floor as the Aquino senator rose to speak").named);
|
|
|
|
console.log("context only (query jobs must REJECT):");
|
|
const ctx = g("Senate OKs 5-year barangay, SK terms", "Lawmakers voted 17-1 on the measure.");
|
|
check("generic senate bill rejected from queries", !ctx.ok);
|
|
const ctx2 = g("Hunting in the zoo", "A BusinessMirror opinion on the week's senate docket.");
|
|
check("op-ed noise rejected", !ctx2.ok);
|
|
|
|
console.log("context (native fallback may ADMIT):");
|
|
check("Aquino + senate admitted in fallback", bamRelevance("Aquino echoes call to probe power outages", "", { requireNamed: false }).ok);
|
|
check("bare 'senate bill' rejected even in fallback", !bamRelevance("Senate OKs 5-year barangay, SK terms", "", { requireNamed: false }).ok);
|
|
|
|
console.log("non-Bam Aquinos:");
|
|
const mark = g("Mark Aquino to run for mayor", "The former congressman filed his certificate of candidacy.");
|
|
check("Mark Aquino not named-BAM", !mark.named);
|
|
check("Mark Aquino context-admitted in fallback (he IS an Aquino in context)", bamRelevance("Mark Aquino to run for mayor", "The senator's cousin filed his papers.", { requireNamed: false }).ok);
|
|
|
|
console.log("empty:");
|
|
check("empty rejected", !g("", "").ok);
|
|
|
|
console.log(fails ? `\n${fails} FAILED` : "\nall passed");
|
|
process.exit(fails ? 1 : 0);
|