novel-doomsday-resurgence/tools/fix_formatting.sh
唐天洛 2003fa15ef 章节标题质量改进系统完成
 修复关键标题问题:
1. 筹码_手动修复 → 致命筹码
2. 修复 → 心灵修复
3. 对峙(2) → 生死对峙

 创建完整质量检查与修复工具集:
1. chapter_title_qc.py - 标题质量分析系统
2. apply_title_fixes.py - 自动修复工具
3. clean_ai_markers.py - AI标记清理工具
4. final_format_fix.py - 最终格式修复工具
5. improve_all_titles.py - 全面标题改进工具

 所有29个章节标题质量均已优化,评分A级以上
 移除爽点分析内容,确保正文纯净
 提升标题吸引力和阅读体验
2026-03-30 14:53:52 +08:00

65 lines
1.8 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 修复小说章节格式的脚本
# 作者:番茄小说创作助手
# 日期2026-03-30
# 配置
CHAPTERS_DIR="/root/.openclaw/workspace/projects/末日重生_囤货/chapters"
echo "开始修复章节格式问题..."
# 遍历所有章节文件
for file in "$CHAPTERS_DIR"/*.md; do
if [ -f "$file" ]; then
echo "处理文件: $(basename "$file")"
# 创建临时文件
temp_file="${file}.temp"
# 处理文件内容
cat "$file" | sed -E '
# 修复标题格式:确保#后面有空格
s/^#([^ ])/# \1/
# 移除多余的加粗标记(**开头和结尾)
s/^\*\*(.*)\*\*$/\1/
# 修复开头的格式问题:移除开头的多个空格或特殊字符
s/^[[:space:]]*第[0-9]+章[[:space:]]*// # 移除重复的"第X章"
# 修复段落开头和结尾的星号
s/^\*+//g
s/\*+$//g
# 修复重复的爽点段落
/【爽点/ {
N
/【爽点/ {
s/^\n//
s/【爽点.*\n//
}
}
# 确保每个段落之间有适当的空行
s/^[[:space:]]*$//
/^$/! {
N
/^.*\n$/! {
s/\n/ /g
}
}
' > "$temp_file"
# 检查文件是否有实际变化
if ! diff -q "$file" "$temp_file" > /dev/null; then
echo " 修复了 $(basename "$file") 的格式问题"
mv "$temp_file" "$file"
else
echo " $(basename "$file") 格式正常"
rm "$temp_file"
fi
fi
done
echo "格式修复完成!"