### Extract First Paragraph from Stories (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt Iterates through markdown files in the '呐喊' collection. For each story, it extracts the first paragraph (lines not starting with '#') and prints the first 5 lines of that paragraph. ```bash for story in /app/repos/ac-heron/luxun/全集/呐喊/*.md; do echo "=== $(basename "$story" .md) ===" sed -n '/^[^#]/p' "$story" | head -5 echo "" done ``` -------------------------------- ### Extract Section Headers (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt Extracts all lines that start with a '#' character (indicating a header) from all markdown files within the '全集' directory. Uses `grep -h` to suppress filenames in the output. ```bash grep -h '^#' "/app/repos/ac-heron/luxun/全集/"**/*.md ``` -------------------------------- ### Compare and Analyze Works in Luxun Project Source: https://context7.com/ac-heron/luxun/llms.txt This snippet shows advanced techniques for comparing files using 'diff' with process substitution and for extracting initial content using 'head'. Useful for stylistic analysis and comparing different editions or works. ```bash # Compare two short story collections diff <(ls "/app/repos/ac-heron/luxun/全集/呐喊/") \ <(ls "/app/repos/ac-heron/luxun/全集/彷徨/") # Extract and compare writing styles between early and late works head -100 "/app/repos/ac-heron/luxun/全集/呐喊/狂人日记.md" head -100 "/app/repos/ac-heron/luxun/全集/故事新编/出关.md" ``` -------------------------------- ### List and Inspect Visual Materials in Luxun Project Source: https://context7.com/ac-heron/luxun/llms.txt This snippet demonstrates how to list photograph and manuscript image files using 'ls' and inspect their type and metadata using 'file' and 'identify'. Useful for managing and understanding visual assets. ```bash # List all photograph files ls -1 "/app/repos/ac-heron/luxun/鲁迅相/" # Output includes: # Lu-Xun1.gif # Portrait 1 # Lu-Xun2.gif # Portrait 2 # family.gif # Family photo # luxun4.gif # Portrait 4 # luxun5.gif # Portrait 5 # luxun6.gif # Portrait 6 # luxun_tomb.jpg # Lu Xun's tomb # View photograph metadata file "/app/repos/ac-heron/luxun/鲁迅相/Lu-Xun1.gif" identify "/app/repos/ac-heron/luxun/鲁迅相/Lu-Xun1.gif" # List all handwritten manuscript images ls -1 "/app/repos/ac-heron/luxun/手稿图片/" # Output includes: # handwriting1.jpg # Handwritten manuscript sample 1 # handwriting2.jpg # Handwritten manuscript sample 2 # poetry1.gif # Handwritten poetry 1 # poetry2.gif # Handwritten poetry 2 # poetry3.gif # Handwritten poetry 3 # View manuscript image details file "/app/repos/ac-heron/luxun/手稿图片/handwriting1.jpg" ``` -------------------------------- ### Show Repository Statistics using Git Commands Source: https://context7.com/ac-heron/luxun/llms.txt This snippet displays various statistics about the git repository, including the total number of commits, the number of contributors, the date of the first commit, and the date of the last commit. It uses standard git commands and shell utilities for output formatting. ```shell cd /app/repos/ac-heron/luxun echo "Total commits: $(git rev-list --count HEAD)" echo "Contributors: $(git shortlog -s -n | wc -l)" echo "First commit: $(git log --reverse --format="%ai" | head -1)" echo "Last commit: $(git log -1 --format="%ai")" ``` -------------------------------- ### Load and Process Lu Xun Works (Python) Source: https://context7.com/ac-heron/luxun/llms.txt Provides Python functions to read individual works, list works in a collection, search across all works for a keyword, and perform basic vocabulary analysis by counting character frequencies. Uses `pathlib` for file operations and `collections.Counter` for frequency analysis. ```python import os from pathlib import Path from collections import Counter # Load a single work def read_work(filename): with open(filename, 'r', encoding='utf-8') as f: return f.read() # Example: Read "A Madman's Diary" madman_diary = read_work('/app/repos/ac-heron/luxun/全集/呐喊/狂人日记.md') print(f"Length: {len(madman_diary)} characters") # List all works in a collection def list_collection(collection_name): base_path = Path('/app/repos/ac-heron/luxun/全集') collection_path = base_path / collection_name return list(collection_path.glob('*.md')) # Example: Get all stories in "Call to Arms" stories = list_collection('呐喊') print(f"Found {len(stories)} stories in '呐喊'") # Search across all works def search_all_works(keyword): results = [] base_path = Path('/app/repos/ac-heron/luxun/全集') for md_file in base_path.rglob('*.md'): with open(md_file, 'r', encoding='utf-8') as f: content = f.read() if keyword in content: count = content.count(keyword) results.append((str(md_file), count)) return sorted(results, key=lambda x: x[1], reverse=True) # Example: Find works mentioning "革命" revolution_works = search_all_works('革命') for work, count in revolution_works[:10]: print(f"{Path(work).name}: {count} occurrences") # Generate word frequency analysis def analyze_vocabulary(filename): import re with open(filename, 'r', encoding='utf-8') as f: text = f.read() # Simple Chinese character segmentation chars = re.findall(r'[\u4e00-\u9fff]', text) return Counter(chars) # Example: Analyze most common characters in a work char_freq = analyze_vocabulary('/app/repos/ac-heron/luxun/全集/呐喊/阿Q正传.md') print("Top 20 characters:", char_freq.most_common(20)) ``` -------------------------------- ### Generate Collection Catalog (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt Creates a catalog of all markdown files within the '全集' directory. For each file, it records the file path, collection name, title, size in bytes, and line count. The output is saved to 'catalog.txt'. ```bash find "/app/repos/ac-heron/luxun/全集" -name "*.md" | while read file; do echo "File: $file" echo "Collection: $(dirname "$file" | xargs basename)" echo "Title: $(basename "$file" .md)" echo "Size: $(wc -c < "$file") bytes" echo "Lines: $(wc -l < "$file") lines" echo "---" done > catalog.txt ``` -------------------------------- ### Find Files by Name in Luxun Project Source: https://context7.com/ac-heron/luxun/llms.txt This snippet demonstrates how to find files within the Luxun project directory based on patterns in their filenames. It uses the 'find' command with the '-name' option. Useful for locating specific documents or types of files. ```bash # Find all files containing "日记" (diary) in filename find "/app/repos/ac-heron/luxun" -name "*日记*" # Find all files containing "新编" (retold) find "/app/repos/ac-heron/luxun" -name "*新编*" # Find all prefaces and introductions find "/app/repos/ac-heron/luxun" -name "*序言*" -o -name "*自序*" ``` -------------------------------- ### Perform Thematic Analysis on Luxun Project Works Source: https://context7.com/ac-heron/luxun/llms.txt This snippet demonstrates thematic analysis by counting the occurrences of specific keywords related to social criticism within all Markdown files. It uses 'grep' in a loop to analyze frequency. It also shows how to find works mentioning historical events. ```bash # Analyze frequency of social criticism themes themes=("封建" "革命" "国民性" "吃人" "奴隶" "自由") for theme in "${themes[@]}"; do count=$(grep -r "$theme" "/app/repos/ac-heron/luxun/全集/" --include="*.md" | wc -l) echo "$theme: $count occurrences" done # Find all works mentioning specific historical events grep -r "辛亥革命" "/app/repos/ac-heron/luxun/全集/" --include="*.md" -l grep -r "五四运动" "/app/repos/ac-heron/luxun/全集/" --include="*.md" -l ``` -------------------------------- ### View Directory Structure (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt This command displays the hierarchical structure of the Lu Xun digital archive repository. It helps in understanding the organization of various works, categorized by type and collection. ```bash tree /app/repos/ac-heron/luxun ``` -------------------------------- ### Read Critical Essays from Luxun Project Source: https://context7.com/ac-heron/luxun/llms.txt This snippet shows how to read individual critical essay files using the 'cat' command. It lists essays by various authors and on different topics related to Lu Xun. These are Markdown files. ```bash # Read Wang Shuo's essay on Lu Xun cat "/app/repos/ac-heron/luxun/评论/王朔《我看鲁迅》.md" # Read Lin Yutang's essay "On Lu Xun's Death" cat "/app/repos/ac-heron/luxun/评论/林语堂《鲁迅之死》.md" # Read Liang Shiqiu's essay on Lu Xun cat "/app/repos/ac-heron/luxun/评论/梁实秋《关于鲁迅》.md" # Read Yu Dafu's memorial essay cat "/app/repos/ac-heron/luxun/评论/郁达夫《怀鲁迅》.md" ``` -------------------------------- ### Search Keywords Across All Works (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt These commands enable searching for specific keywords across all markdown files within the 'Complete Works' directory of the archive. It utilizes `grep -r` for recursive searching and can count occurrences using `wc -l`. ```bash # Search for mentions of "revolution" (革命) in all works grep -r "革命" "/app/repos/ac-heron/luxun/全集/" --include="*.md" # Search for mentions of "Chinese people" (中国人) grep -r "中国人" "/app/repos/ac-heron/luxun/全集/" --include="*.md" # Search for specific character names (e.g., 阿Q) grep -r "阿Q" "/app/repos/ac-heron/luxun/全集/" --include="*.md" # Count occurrences of a theme grep -r "国民性" "/app/repos/ac-heron/luxun/全集/" --include="*.md" | wc -l ``` -------------------------------- ### Create Table of Contents (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt Generates a markdown table of contents for the Lu Xun complete works. It organizes entries by collection and lists the titles of works within each collection. The output is saved to 'toc.md'. ```bash echo "# Lu Xun Complete Works - Table of Contents" > toc.md for collection in /app/repos/ac-heron/luxun/全集/*/; do echo "## $(basename "$collection")" >> toc.md ls -1 "$collection"*.md | while read file; do echo "- $(basename "$file" .md)" >> toc.md done done ``` -------------------------------- ### Find Criticism on Lu Xun's Influence (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt Recursively searches markdown files in the '评论' directory for mentions of Lu Xun's influence on later writers. Uses `grep -r` with a specific pattern. ```bash grep -r "影响.*作家" "/app/repos/ac-heron/luxun/评论/" --include="*.md" ``` -------------------------------- ### List and Filter Critical Essays in Luxun Project Source: https://context7.com/ac-heron/luxun/llms.txt This snippet demonstrates listing all critical essays in a directory and filtering them by author or counting them by topic keywords. It utilizes 'ls' for listing and 'grep' for filtering and counting. Useful for managing and analyzing essay collections. ```bash # List all critical essays alphabetically ls -1 "/app/repos/ac-heron/luxun/评论/" # Find essays by specific authors ls -1 "/app/repos/ac-heron/luxun/评论/" | grep "王朔" ls -1 "/app/repos/ac-heron/luxun/评论/" | grep "余杰" ls -1 "/app/repos/ac-heron/luxun/评论/" | grep "钱理群" # Count essays by topic keywords ls -1 "/app/repos/ac-heron/luxun/评论/" | grep -c "阿Q" ls -1 "/app/repos/ac-heron/luxun/评论/" | grep -c "鲁迅研究" ``` -------------------------------- ### Generate Content Statistics for Luxun Project Works Source: https://context7.com/ac-heron/luxun/llms.txt This snippet provides shell commands to generate statistics like total lines, total characters, and identify the longest works across all Markdown files in the '全集' directory. It uses 'find', 'wc', and 'sort'. ```bash # Count total lines in all works find "/app/repos/ac-heron/luxun/全集" -name "*.md" -exec wc -l {} + | tail -1 # Count characters in all works find "/app/repos/ac-heron/luxun/全集" -name "*.md" -exec wc -m {} + | tail -1 # Find the longest work find "/app/repos/ac-heron/luxun/全集" -name "*.md" -exec wc -l {} + | sort -n | tail -5 # Count works by collection for dir in /app/repos/ac-heron/luxun/全集/*/; do echo "$(basename "$dir"): $(find "$dir" -name "*.md" | wc -l) files" done ``` -------------------------------- ### List Stories in a Collection (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt These commands list the files within specific collections of Lu Xun's works, such as short stories in 'Call to Arms' ('呐喊'), prose poems in 'Wild Grass' ('野草'), and historical fictions in 'Old Tales Retold' ('故事新编'). It uses `ls -1` for a one-file-per-line output. ```bash # List all stories in "Call to Arms" (呐喊) ls -1 "/app/repos/ac-heron/luxun/全集/呐喊/" # List all prose poems in "Wild Grass" (野草) ls -1 "/app/repos/ac-heron/luxun/全集/野草/" # List all historical fictions in "Old Tales Retold" ls -1 "/app/repos/ac-heron/luxun/全集/故事新编/" ``` -------------------------------- ### Search Within Critical Essays in Luxun Project Source: https://context7.com/ac-heron/luxun/llms.txt This snippet shows how to search for specific content within critical essays using the 'grep' command. It supports recursive searching, including specific file types, and finding files that contain certain terms. Useful for deep content analysis. ```bash # Search for discussions of specific works in criticism grep -r "狂人日记" "/app/repos/ac-heron/luxun/评论/" --include="*.md" # Search for discussions of Lu Xun's influence grep -r "影响" "/app/repos/ac-heron/luxun/评论/" --include="*.md" # Find essays mentioning specific themes grep -l "国民性" "/app/repos/ac-heron/luxun/评论/"*.md ``` -------------------------------- ### View Git Commit History (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt Commands to view Git commit history for the Lu Xun repository. Includes options to show a concise log (`--oneline`), log with file status changes, and filter logs by directory. ```bash # View commit history cd /app/repos/ac-heron/luxun git log --oneline # See what files were added in recent commits git log --name-status --oneline -10 # Check current repository status git status # View changes in specific collections git log --oneline -- 全集/呐喊/ git log --oneline -- 评论/ ``` -------------------------------- ### Find Critical Essays by Work (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt Searches for markdown files in the '评论' directory that mention a specific work. Uses `grep -l` to list files containing the work's title. ```bash work="狂人日记" grep -l "$work" "/app/repos/ac-heron/luxun/评论/"*.md ``` -------------------------------- ### Search Within Specific Collections (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt This command searches for keywords within specific sub-collections of Lu Xun's works, such as short stories or essays. It also demonstrates how to display search results with line numbers and context using `grep -n -C 3`. ```bash # Search only in short story collections grep -r "狂人" "/app/repos/ac-heron/luxun/全集/呐喊/" --include="*.md" grep -r "狂人" "/app/repos/ac-heron/luxun/全集/彷徨/" --include="*.md" # Search only in essay collections grep -r "自由" "/app/repos/ac-heron/luxun/全集/伪自由书/" --include="*.md" # Search with line numbers and context grep -n -C 3 "吃人" "/app/repos/ac-heron/luxun/全集/呐喊/狂人日记.md" ``` -------------------------------- ### Access Biographical Information for Lu Xun Source: https://context7.com/ac-heron/luxun/llms.txt This snippet demonstrates accessing biographical data for Lu Xun using the 'cat' command. It includes reading an encyclopedia entry and a detailed chronology. The output provides key life details and events. ```bash # Read the encyclopedia biography cat "/app/repos/ac-heron/luxun/辞海:鲁迅传略.md" # Output includes: # - Birth: September 25, 1881, Shaoxing, Zhejiang # - Death: October 19, 1936, Shanghai # - Original name: Zhou Shuren (周树人) # - Major works: Call to Arms, Wandering, Wild Grass, etc. # - Key life events: Japan studies, literary career, revolutionary activities # Read the detailed chronology by Xu Shoushang cat "/app/repos/ac-heron/luxun/许寿裳《鲁迅先生年谱》.md" ``` -------------------------------- ### Count Markdown Files (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt These commands count the total number of markdown files within the archive, the number of collections in the 'Complete Works' directory, and the number of critical essays. This provides an overview of the archive's content volume. ```bash # Count total markdown files find /app/repos/ac-heron/luxun -type f -name "*.md" | wc -l # Count works by collection find /app/repos/ac-heron/luxun/全集 -type d -maxdepth 1 | wc -l # Count critical essays ls -1 /app/repos/ac-heron/luxun/评论/ | wc -l ``` -------------------------------- ### Extract Key Dates and Mentions from Lu Xun Biography Source: https://context7.com/ac-heron/luxun/llms.txt This snippet shows how to extract specific information like birth/death dates, publication years, and family mentions from Lu Xun's biographical documents using 'grep'. It uses basic string matching and extended regular expressions. ```bash # Extract birth and death information grep "1881|1936" "/app/repos/ac-heron/luxun/辞海:鲁迅传略.md" # Extract publication dates of major works grep "1918|1926|1927" "/app/repos/ac-heron/luxun/辞海:鲁迅传略.md" # Find mentions of Lu Xun's family grep -E "周作人|许广平|周海婴|朱安" "/app/repos/ac-heron/luxun/辞海:鲁迅传略.md" ``` -------------------------------- ### Find File Addition Date using Git Log Source: https://context7.com/ac-heron/luxun/llms.txt This command uses git log to identify when a specific file or set of files were first added to the repository. It filters for added files (`--diff-filter=A`), shows only the filenames (`--name-only`), and formats the output to show just the file path without commit details. ```shell git log --diff-filter=A --name-only --pretty=format: -- 全集/呐喊/狂人日记.md ``` -------------------------------- ### Read Specific Short Stories (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt This command allows direct access to the content of specific short stories by Lu Xun, such as 'A Madman's Diary', 'The True Story of Ah Q', 'Medicine', and 'Blessing'. It uses the `cat` command to display the file content. ```bash # Access Lu Xun's most famous work "A Madman's Diary" (狂人日记) cat "/app/repos/ac-heron/luxun/全集/呐喊/狂人日记.md" # Read "The True Story of Ah Q" (阿Q正传) cat "/app/repos/ac-heron/luxun/全集/呐喊/阿Q正传.md" # Read "Medicine" (药) cat "/app/repos/ac-heron/luxun/全集/呐喊/药.md" # Read "Blessing" (祝福) cat "/app/repos/ac-heron/luxun/全集/彷徨/祝福.md" ``` -------------------------------- ### Browse Essay Collections (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt This command allows browsing through essay collections by Lu Xun. It uses `find` to locate all markdown files within specified essay directories like 'Canopy Collection' ('华盖集'), 'Two Hearts' ('二心集'), and 'Three Leisures' ('三闲集'). ```bash # List essays in "Canopy Collection" (华盖集) find "/app/repos/ac-heron/luxun/全集/华盖集" -name "*.md" | head -20 # List essays in "Two Hearts" (二心集) find "/app/repos/ac-heron/luxun/全集/二心集" -name "*.md" # List essays in "Three Leisures" (三闲集) find "/app/repos/ac-heron/luxun/全集/三闲集" -name "*.md" ``` -------------------------------- ### Extract Opinions from Critical Essays (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt Iterates through markdown files in the '评论' directory that contain '鲁迅' in their name. Extracts the first 50 lines and then filters for lines mentioning '鲁迅's thought' or 'works'. ```bash for essay in /app/repos/ac-heron/luxun/评论/*鲁迅*.md; do echo "=== $(basename "$essay") ===" head -50 "$essay" | grep -E "鲁迅.*思想|鲁迅.*作品" done ``` -------------------------------- ### Catalog Critical Essays by Author (Python) Source: https://context7.com/ac-heron/luxun/llms.txt A Python function that catalogs critical essays based on their filenames. It parses filenames assuming a pattern like 'Author《Title》.md' to extract the author and title, and records the file path and size. The catalog is returned as a dictionary. ```python from pathlib import Path import json # Catalog all critical essays by author def catalog_essays(): essays_path = Path('/app/repos/ac-heron/luxun/评论') catalog = {} for essay_file in essays_path.glob('*.md'): filename = essay_file.name # Extract author from filename pattern "作者《标题》.md" if '《' in filename and '》' in filename: author = filename.split('《')[0] title = filename.split('《')[1].split('》')[0] if author not in catalog: catalog[author] = [] catalog[author].append({ 'title': title, 'file': str(essay_file), 'size': essay_file.stat().st_size }) return catalog # Example usage essay_catalog = catalog_essays() print(f"Found essays by {len(essay_catalog)} authors") for author, essays in sorted(essay_catalog.items())[:5]: print(f"\n{author}: {len(essays)} essay(s)") for essay in essays: print(f" - {essay['title']}") ``` -------------------------------- ### Extract Direct Speech (Bash) Source: https://context7.com/ac-heron/luxun/llms.txt Extracts all lines containing quotation marks (double or single) from the '狂人日记.md' file. Uses `grep -h` to suppress filenames in the output. ```bash grep -h '[""]' "/app/repos/ac-heron/luxun/全集/呐喊/狂人日记.md" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.