ProjectsNewsScope
← Projects

NewsScope

Scores a news article's credibility in C++ and explains the score: source reputation, suspicious phrasing, clickbait patterns and how well claims are attributed, each reported on its own.

  • C++ 82%
  • CSS 5%
  • JavaScript 4%
  • Python 3%
  • HTML 3%

live from github.com/Team-ADAPT/NewsScope, refreshed daily

Year
2026
Team and role
Team ADAPT, with the algorithms split four ways. I did the scoring engine, claim verification and the concurrency; Divyanshi Singh the preprocessing and frequency analysis; Tanishk Gupta source validation, the phrase trie and temporal signals; Prajjwal Singh the KMP / Rabin-Karp matching and greedy filtering.
Built with
C++17POSIX socketsPythonscikit-learnDocker
See it
Code ↗

The problem

Most fake-news detectors give one label and no reason. That isn't much use to a reader deciding whether to trust an article. NewsScope scores an article on separate signals and returns each one with a line explaining it, so you can see why it scored low. The core is rule-based, so the same article always gets the same score.

How it works

The whole server is C++: a hand-written HTTP server on POSIX sockets, with no web framework.

browser -> POST /api/jobs {text or url, source}
  -> validate; for a URL, resolve DNS, refuse private addresses, fetch
  -> job queued on the analysis thread pool
  -> preprocess -> source reputation, phrase trie, KMP / Rabin-Karp
     pattern matching, word frequency, timing signals, claim attribution
  -> rule-based score (0-100) + one explanation per module
  -> optional: Python model nudges the score
browser polls GET /api/jobs/{id} -> verdict and module breakdown

Network I/O and analysis run on separate thread pools, so slow fetches don't block scoring. The job table is capped (2,000 running, 5,000 stored) so a flood of requests can't exhaust memory. When a URL is fetched, the server resolves the hostname itself, rejects private addresses, then pins the download to the IP it checked, which blocks DNS-rebinding tricks.

Two decisions

The model can only nudge. A TF-IDF and logistic-regression model is optional and off by default. When it's on, its weight scales with its own confidence, it's ignored below 20% confidence, and it can pull down a strong rule-based score (75 or more) by at most 6 points. The explanations stay meaningful because the rules still decide most of the score. The cost is a set of hand-tuned constants with no recorded evaluation behind them yet.

One long-lived Python process, not one per request. The C++ engine starts the Python model once, waits for a READY handshake, then sends it one JSON line per article over a pipe. Spawning Python for every request, which the first version did, paid the interpreter and model start-up cost every time. The cost now: one process serves every request, so model calls run one at a time.

What broke

The analyzers kept their working state (word counts, a cache of suspicious terms) as member variables. That was fine in a command-line tool. Inside a multithreaded server, every request shared the same analyzer objects, so concurrent articles could mix each other's counts. The fix (commit f204a92) made the analyzers stateless: analyze() became const and returns its results instead of storing them. The same commit replaced per-request Python with the long-lived process.