skhaz/hackernews-sentiment-analysis

Python

0

11 commits

updated Sep 23, 2026

See the code

See what people are saying

README

Hacker News Sentiment Analysis

Fetches a random Hacker News comment and scores it with Laya, a local System One decision model. No LLM, no account, no API key.

Requirements

  • uv (Python 3.13 is installed automatically)
  • Internet for the Hacker News API and the one-time model download (~2.2 GB, cached in ~/.cache/huggingface)

Usage

uv run main.py
uv run main.py --comment "This is the best explanation I have ever read!"
uv run main.py --min-points 50
uv run main.py --download-only   # cache all Laya checkpoints and exit

With no flags, it prints a fetching notice, the comment, and the analysis:

Fetching a random Hacker News comment...
Comment by simonw

"Is this meant to link to the article..."

---------- analysis ----------
Sentiment:    Neutral ████████░░ 79%
Sarcasm:      No (not sarcastic) █████████░ 89%
Emotion:      Neutral ████████░░ 76%
Toxicity:     Not toxic █████████░ 93%
Constructive: Not constructive ██░░░░░░░░
Useful:       █░░░░░░░░░ 12%

How it works

  1. Picks a random story with a score above --min-points (default 10) from the official Hacker News Firebase API, then a random comment from it. Comment scores are not exposed by any public API, so the filter applies to the story score.
  2. Runs one Router().predict() call with 7 typed questions (choice/score/noul) in a single forward pass — no text is generated, so nothing is parsed and nothing is hallucinated.
  3. Renders the probabilities with Jinja2 templates.

After the first run, analysis is fully offline (HF_HUB_OFFLINE=1).

Contributors

skhaz

11 commits

skhaz/hackernews-sentiment-analysis

Python

0

11 commits

updated Sep 23, 2026

See the code

See what people are saying

README

Hacker News Sentiment Analysis

Fetches a random Hacker News comment and scores it with Laya, a local System One decision model. No LLM, no account, no API key.

Requirements

  • uv (Python 3.13 is installed automatically)
  • Internet for the Hacker News API and the one-time model download (~2.2 GB, cached in ~/.cache/huggingface)

Usage

uv run main.py
uv run main.py --comment "This is the best explanation I have ever read!"
uv run main.py --min-points 50
uv run main.py --download-only   # cache all Laya checkpoints and exit

With no flags, it prints a fetching notice, the comment, and the analysis:

Fetching a random Hacker News comment...
Comment by simonw

"Is this meant to link to the article..."

---------- analysis ----------
Sentiment:    Neutral ████████░░ 79%
Sarcasm:      No (not sarcastic) █████████░ 89%
Emotion:      Neutral ████████░░ 76%
Toxicity:     Not toxic █████████░ 93%
Constructive: Not constructive ██░░░░░░░░
Useful:       █░░░░░░░░░ 12%

How it works

  1. Picks a random story with a score above --min-points (default 10) from the official Hacker News Firebase API, then a random comment from it. Comment scores are not exposed by any public API, so the filter applies to the story score.
  2. Runs one Router().predict() call with 7 typed questions (choice/score/noul) in a single forward pass — no text is generated, so nothing is parsed and nothing is hallucinated.
  3. Renders the probabilities with Jinja2 templates.

After the first run, analysis is fully offline (HF_HUB_OFFLINE=1).

Contributors

skhaz

11 commits

Languages

Python

100.0%