"vault backup: 2025-11-16 22:40:43 from Flow"

This commit is contained in:
2025-11-16 22:40:43 +09:00
parent 9b22bf49c9
commit 3d895b299f
2 changed files with 51 additions and 0 deletions

View File

@@ -99,6 +99,16 @@ Always respond in Markdown. Use headings, lists, and bold text for clarity.
3. **Broken Link Check:** Scan the entire vault for internal links pointing to non-existent notes and report them. 3. **Broken Link Check:** Scan the entire vault for internal links pointing to non-existent notes and report them.
4. **Workflow Integrity Check:** A self-audit to ensure temporary files from other workflows have been properly deleted. 4. **Workflow Integrity Check:** A self-audit to ensure temporary files from other workflows have been properly deleted.
- **[Memory/Workflow Name]:** Chinese Note Completion Workflow
- **Value:** This workflow automatically completes Chinese vocabulary entries in notes by finding and filling in missing Hanzi, Pinyin, or English translations. It uses a dedicated Python script for Pinyin conversion.
- **Example Protocol:**
1. **Trigger:** Manually run on a specific Chinese note file.
2. **Action:** The assistant scans the note for incomplete entries (missing Hanzi, Pinyin, or translation).
3. **Action (Pinyin):** If Pinyin is missing, it executes the `00-Meta/scripts/get_pinyin.py` script with the Hanzi as an argument to get the correct Pinyin.
4. **Action (Translation):** If the English translation is missing, it uses a web search to find the translation for the Hanzi/Pinyin.
5. **Action (Hanzi):** If Hanzi is missing, it uses a web search with the Pinyin and/or translation to find the characters.
6. **Action:** The assistant updates the note file with the completed entries.
- **[Memory/Workflow Name]:** [Brief Description of the Task] - **[Memory/Workflow Name]:** [Brief Description of the Task]
- **Value:** [Why this task is useful/complex to record] - **Value:** [Why this task is useful/complex to record]
- **Example Protocol:** [Step-by-step instructions or key constraint used to achieve the desired outcome] - **Example Protocol:** [Step-by-step instructions or key constraint used to achieve the desired outcome]

View File

@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
"""
This script converts a string of Chinese characters (Hanzi) into Pinyin with tone marks.
Usage:
python get_pinyin.py "你的汉字"
Example:
python get_pinyin.py "你好"
Expected output: nǐ hǎo
"""
import sys
from pypinyin import pinyin, Style
def get_pinyin(text):
"""
Converts a string of Hanzi characters to a Pinyin string with tone marks.
Args:
text (str): The Hanzi string to convert.
Returns:
str: The resulting Pinyin string.
"""
# The pinyin() function returns a list of lists, e.g., [['nǐ'], ['hǎo']]
# We use a list comprehension to flatten it and then join the elements with a space.
pinyin_list = pinyin(text, style=Style.TONE)
return " ".join([item[0] for item in pinyin_list])
if __name__ == "__main__":
# Check if a command-line argument was provided
if len(sys.argv) > 1:
# The first argument (sys.argv[0]) is the script name,
# so the Hanzi text is the second argument (sys.argv[1]).
hanzi_text = sys.argv[1]
pinyin_output = get_pinyin(hanzi_text)
print(pinyin_output)
else:
# If no argument is provided, print the usage instructions.
print('Usage: python get_pinyin.py "你的汉字"')
print('Example: python get_pinyin.py "你好"')