Skip to content

Repository files navigation

Language: English | 简体中文 | 繁體中文 | 日本語

Dianalyze — Dialectical Weekly Deep Analysis

Tests Coverage Python

Dialectical weekly news analysis powered by AI. Uses dialectical materialism and historical materialism as core methodology, supported by modern analytical techniques (evidence verification, quantitative data, scenario planning). Output: structured JSON + Markdown article. Rendered on blog.

Architecture

Weibo / Zhihu / Hacker News (real-time scrape)
  ↓ Fetch trending topics + deduplication
[Phase 0] Scrape & Cache
  ↓ Fall back to cache if all sources fail
[Phase 1] Censorship Filter (MLM relevance)
  ↓ Exclude entertainment / politically sensitive content
[Phase 2] AI Scoring & Selection
  ↓ Event impact × Information novelty → top 5-8
[Phase 3] Per-event Deep Analysis (parallel, 3 workers)
  ↓ DuckDuckGo + Bing search → Timeline + Evidence + Edges
[Phase 4] Cross-event Synthesis
  ↓ Themes + Trends + Contradictions in motion
Output → JSON + Markdown article → Blog-mizuki repo

Project Structure

weekly-cli/          # Python CLI pipeline
  main.py            # Orchestrator: 5-phase pipeline driver
  config.py           # Environment variable config + path safety
  schema.py           # Pydantic v2 data models (14 models)
  censor.py           # Phase 1: Censorship filter
  scorer.py           # Phase 2: Scoring & selection
  analyzer.py         # Phase 3: Per-event deep analysis
  search.py           # Parallel DuckDuckGo + Bing search with dedup
  synthesizer.py      # Phase 4: Cross-event synthesis
  article.py          # Markdown article generator
  cache.py            # Scrape cache fallback
  test_*.py           # Unit & integration tests (80%+ coverage)
prompts/              # Externalized LLM prompt templates

## Usage

### Manual

```bash
export DEEPSEEK_API_KEY=sk-your-key
export BLOG_CONTENT_DIR=/path/to/Blog-mizuki/src/content/weekly
cd weekly-cli && pip install -r requirements.txt && python main.py

Automated (GitHub Actions)

Runs every Monday 00:00 UTC. Results pushed to Blog-mizuki repo.

Required GitHub Secrets:

  • DEEPSEEK_API_KEY — DeepSeek API key
  • BLOG_PAT — Personal Access Token with write access to Blog-mizuki repo

Tech Stack

  • AI: DeepSeek API (deepseek-chat)
  • Backend: Python 3 + openai SDK + Pydantic
  • Frontend: Astro 4 + React 18 + TypeScript + Tailwind CSS
  • Visualization: react-force-graph-2d (D3-force)

Related


Language / 语言 / 言語

English | 简体中文 | 繁體中文 | 日本語

About

格物 (Dianalyze) — 辩证周报 · AI 驱动的唯物辩证法热点深度分析

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages