Overview
This skill performs on Traditional Chinese articles two-stage analysis:
- Quantitative stage: runs Python scripts to produce objective data metrics (with line-number localization)
- Qualitative stage: based on the quantitative data, the LLM performs deep rhetorical, allusive, and argumentative-structure analysis
Finally integrated into an "article fingerprint report".
Stage One: Quantitative Analysis (Python Script)
Prerequisites
pip install jieba --break-system-packages -q
Run the analysis script
The script is located at scripts/zh_analyzer.py, and accepts an article file path as input:
python3 /path/to/skill/scripts/zh_analyzer.py /path/to/article.txt
The script outputs quantitative analysis results in JSON format, including the following modules:
Module A: Basic Statistics
- Total word count, total paragraph count, total sentence count
- Distribution of word count per paragraph (mean, standard deviation, maximum and minimum)
- Distribution of word count per sentence (mean, standard deviation, coefficient of variation)
- Punctuation density and distribution
Module B: Lexical Richness
- Type-Token Ratio (TTR): number of unique words / total words
- Hapax Legomena ratio: proportion of words that appear only once
- Word frequency distribution (top 30 most frequent words, marked as function words/content words)
- Function word fingerprint: usage frequency vector of function words (的, 了, 在, 把, 被, 而, 則, 之, 其)
Module C: Sentence Rhythm Analysis (Rhythm)
- Shannon Entropy of the sentence-length sequence (predictability)
- Coefficient of variation of sentence length (sense of rhythmic fluctuation)
- Four-character pattern density (occurrences per thousand words, with precise positions)
- Distribution of "breath-unit" lengths segmented by punctuation
- Detection of alternating long and short sentence patterns
Module D: Register Features (Register)
- Classical-vernacular ratio: proportion of classical Chinese vocabulary (based on detection of common classical function words and sentence patterns)
- Idiom and four-character pattern density
- Character frequency tier distribution: proportions of common characters / less common characters / rare characters
- Density of loanwords and proper nouns
Module E: Paragraph-Level Emotional Arc
- Rough estimate of positive/negative sentiment for each paragraph (based on a sentiment lexicon)
- Marking of emotional turning points (paragraph numbers)
All metrics are accompanied by line number ranges or paragraph numbers, so that they can be cited precisely in the report.
Read the analysis results
The script outputs JSON to stdout; for an example format, see references/output_schema.md。
Stage Two: Qualitative Analysis (LLM Deep Interpretation)
Based on the quantitative data and the original text, perform the following qualitative analysis. Each analysis must cite specific paragraphs or line numbers.
F: Citation and Allusion Mapping (Intertextuality)
Scan the article paragraph by paragraph and mark all:
- Explicit citations (direct quotation of others' words)
- Allusion/adaptation (rewriting or incorporating known allusions, famous lines, historical events)
- Disciplinary categorization (literature, philosophy, history, science, religion, popular culture, etc.)
- Time span (oldest to newest citation era)
Output format:
段落 3(行 15-18):化用《莊子·逍遙遊》「鯤鵬」意象 → 領域:先秦哲學
段落 7(行 42-44):引用 Steve Jobs 史丹佛演講 → 領域:當代科技/勵志
G: Argumentation structure analysis (Argumentation)
Label the argumentative role of each paragraph:
- Premise (Premise)
- Claim (Claim)
- Evidence (Evidence)
- Rebuttal (Rebuttal)
- Concession (Concession)
- Conclusion (Conclusion)
Calculate the proportion of each role and assess the completeness of the argumentation.
H: Rhetorical device labeling (Rhetorical Devices)
Label rhetorical devices paragraph by paragraph:
- Metaphor (simile, metaphor, metonymy)
- Parallelism, antithesis, climax
- Rhetorical question, hypothetical question
- Hyperbole, personification
- Contrast, anadiplosis, palindrome
- Other (specify the exact device name)
Each label includes: paragraph number, line number range, device name, original text excerpt (within 10 characters).
I: Topic structure and shifts (Topic Flow)
Analyze how the topic advances throughout the text:
- Core topic keywords for each paragraph (3-5)
- Topic turning point (which paragraph begins to switch topics)
- Topic advancement pattern (linear progression / spiraling deeper / contrastive parallel / question-and-answer development)
- Assessment of the degree of opening-closing echo
Report output format
The final report is in Markdown format, with the following structure:
# 文章指紋分析報告
## 一、文章概要
- 檔案名稱 / 標題
- 總字數、段落數、句數
## 二、量化指標摘要
### 2.1 詞彙豐富度
### 2.2 句式節奏特徵
### 2.3 語域特徵
### 2.4 情感弧線圖(用文字描述趨勢或產出簡易圖表)
## 三、質性分析
### 3.1 引用與典故圖譜
### 3.2 論證結構
### 3.3 修辭手法清單
### 3.4 主題結構與轉折
## 四、文章指紋總結
- 風格標籤(例:「學術散文/文白交融/節奏緊湊/引用密集-跨領域」)
- 作者特徵推測
- 與典型風格的比較定位
## 五、附錄:逐段詳細標記表
(每段的所有量化與質性標記彙整)
The report should be saved as a .md file, placed in /mnt/user-data/outputs/ for the user to download.
Workflow
- Confirm that the user has provided an article (file or pasted text)
- If it is pasted text, first save it as
/home/claude/article_input.txt - Install dependencies:
pip install jieba --break-system-packages -q - Run the quantitative script:
python3 scripts/zh_analyzer.py <文章路徑> - Read the JSON results
- Perform qualitative analysis (read the original text paragraph by paragraph, combined with quantitative data)
- Integrate into a report and save to
/mnt/user-data/outputs/article_analysis_report.md - Use
present_filesto present the report
Notes
- All line numbers use 1-based indexing (first line = line 1)
- Paragraphs are separated by blank lines, and paragraph numbering starts from 1
- Four-character pattern detection is not limited to idioms and includes all continuous four-character structures
- Classical-vernacular ratio detection is a rough estimate based on a feature word list, not precise linguistic annotation
- If the article is extremely short (< 200 characters), skip some statistical metrics and note the reason
- Sentiment analysis is a rough estimate, for trend reference only, and not to be used as a basis for precise judgment