$npx -y skills add Supreme-Ultimate/novel-to-script-team --skill style-analysis-skill风格分析技能。分析生成剧本的语言风格,对比爆款剧本,确保网文感和可读性。
| 1 | # 风格分析技能 |
| 2 | |
| 3 | ## 必读 |
| 4 | |
| 5 | 1. `../../references/00-first-principles.md` — 第一性原则(可拍性、留存性) |
| 6 | 2. `../../references/03-script-writing-standard.md` — 剧本写作标准(句长、对话比、视觉标记、网文感关键词) |
| 7 | 3. `../../references/12-genre-specific-techniques.md` — 类型化技巧(男频/女频风格差异) |
| 8 | |
| 9 | ## 功能 |
| 10 | |
| 11 | 深度分析剧本的语言风格,确保生成的剧本具有网文感、节奏感和可读性。 |
| 12 | |
| 13 | ## 分析维度 |
| 14 | |
| 15 | ### 1. 句长分析 |
| 16 | |
| 17 | **统计方法**: |
| 18 | ```python |
| 19 | import re |
| 20 | |
| 21 | def analyze_sentence_length(script): |
| 22 | # 按句号、问号、感叹号分句 |
| 23 | sentences = re.split(r'[。!?]', script) |
| 24 | sentences = [s.strip() for s in sentences if s.strip()] |
| 25 | |
| 26 | lengths = [len(s) for s in sentences] |
| 27 | |
| 28 | return { |
| 29 | 'avg_length': sum(lengths) / len(lengths), |
| 30 | 'short_ratio': len([l for l in lengths if l < 10]) / len(lengths), |
| 31 | 'medium_ratio': len([l for l in lengths if 10 <= l < 20]) / len(lengths), |
| 32 | 'long_ratio': len([l for l in lengths if l >= 20]) / len(lengths) |
| 33 | } |
| 34 | ``` |
| 35 | |
| 36 | **理想指标**: |
| 37 | - 平均句长:10-14字符 |
| 38 | - 短句比例(<10字符):30-40% |
| 39 | - 中句比例(10-20字符):50-60% |
| 40 | - 长句比例(≥20字符):<10% |
| 41 | |
| 42 | ### 2. 对话比分析 |
| 43 | |
| 44 | **统计方法**: |
| 45 | ```python |
| 46 | def analyze_dialogue_ratio(script): |
| 47 | # 识别对话(引号内的内容) |
| 48 | dialogues = re.findall(r'[「『""]([^」』""]+)[」』""]', script) |
| 49 | dialogue_chars = sum(len(d) for d in dialogues) |
| 50 | total_chars = len(script) |
| 51 | |
| 52 | return { |
| 53 | 'dialogue_ratio': dialogue_chars / total_chars, |
| 54 | 'dialogue_count': len(dialogues), |
| 55 | 'avg_dialogue_length': dialogue_chars / len(dialogues) if dialogues else 0 |
| 56 | } |
| 57 | ``` |
| 58 | |
| 59 | **理想指标**: |
| 60 | - 对话比:70-80% |
| 61 | - 对话数量:每1000字15-25条 |
| 62 | - 平均对话长度:20-40字符 |
| 63 | |
| 64 | ### 3. 视觉标记分析 |
| 65 | |
| 66 | **视觉标记列表**: |
| 67 | ```python |
| 68 | visual_markers = { |
| 69 | '表情': ['冷笑', '嗤笑', '冷哼', '微笑', '狞笑', '苦笑'], |
| 70 | '眼神': ['眼神一冷', '眸光一沉', '目光如炬', '眼中闪过', '瞳孔一缩'], |
| 71 | '动作': ['嘴角勾起', '挑眉', '皱眉', '咬牙', '握拳', '转身'], |
| 72 | '气场': ['气势汹汹', '霸气侧漏', '冷气逼人', '杀气腾腾'] |
| 73 | } |
| 74 | ``` |
| 75 | |
| 76 | **统计方法**: |
| 77 | ```python |
| 78 | def analyze_visual_markers(script): |
| 79 | all_markers = [] |
| 80 | for category, markers in visual_markers.items(): |
| 81 | all_markers.extend(markers) |
| 82 | |
| 83 | marker_count = sum(script.count(marker) for marker in all_markers) |
| 84 | chars_per_100 = len(script) / 100 |
| 85 | |
| 86 | return { |
| 87 | 'markers_per_100': marker_count / chars_per_100, |
| 88 | 'marker_distribution': { |
| 89 | category: sum(script.count(m) for m in markers) |
| 90 | for category, markers in visual_markers.items() |
| 91 | } |
| 92 | } |
| 93 | ``` |
| 94 | |
| 95 | **理想指标**: |
| 96 | - 视觉标记密度:3-5个/100字 |
| 97 | - 分布均衡:各类标记都有使用 |
| 98 | |
| 99 | ### 4. 网文感关键词分析 |
| 100 | |
| 101 | **网文感关键词**: |
| 102 | ```python |
| 103 | wanwen_keywords = { |
| 104 | '情绪强化': ['冷笑', '嗤笑', '冷哼', '冷声', '冷冷地'], |
| 105 | '态度词': ['不屑', '轻蔑', '讥讽', '嘲讽', '鄙夷'], |
| 106 | '气场词': ['霸气', '强势', '凌厉', '锐利', '凛然'], |
| 107 | '反转词': ['没想到', '竟然', '居然', '原来', '突然'], |
| 108 | '打脸词': ['啪啪打脸', '狠狠打脸', '当场打脸', '脸色一变'] |
| 109 | } |
| 110 | ``` |
| 111 | |
| 112 | **统计方法**: |
| 113 | ```python |
| 114 | def analyze_wanwen_keywords(script): |
| 115 | all_keywords = [] |
| 116 | for category, keywords in wanwen_keywords.items(): |
| 117 | all_keywords.extend(keywords) |
| 118 | |
| 119 | keyword_count = sum(script.count(kw) for kw in all_keywords) |
| 120 | chars_per_100 = len(script) / 100 |
| 121 | |
| 122 | return { |
| 123 | 'keywords_per_100': keyword_count / chars_per_100, |
| 124 | 'keyword_distribution': { |
| 125 | category: sum(script.count(kw) for kw in keywords) |
| 126 | for category, keywords in wanwen_keywords.items() |
| 127 | } |
| 128 | } |
| 129 | ``` |
| 130 | |
| 131 | **理想指标**: |
| 132 | - 网文感关键词:1.5-2.5个/100字 |
| 133 | - 分布:情绪强化词最多,其他均衡 |
| 134 | |
| 135 | ### 5. 节奏感分析 |
| 136 | |
| 137 | **统计方法**: |
| 138 | ```python |
| 139 | def analyze_rhythm(script): |
| 140 | # 按场景分割 |
| 141 | scenes = re.split(r'场景\d+|第\d+场', script) |
| 142 | |
| 143 | scene_lengths = [len(s) for s in scenes if s.strip()] |
| 144 | |
| 145 | return { |
| 146 | 'scene_count': len(scene_lengths), |
| 147 | 'avg_scene_length': sum(scene_lengths) / len(scene_lengths), |
| 148 | 'length_variance': calculate_variance(scene_lengths), |
| 149 | 'rhythm_score': calculate_rhythm_score(scene_lengths) |
| 150 | } |
| 151 | ``` |
| 152 | |
| 153 | **理想指标**: |
| 154 | - 场景数:7-10个/集 |
| 155 | - 平均场景长度:100-150字 |
| 156 | - 长度方差:适中(有变化但不极端) |
| 157 | |
| 158 | ## 对比分析 |
| 159 | |
| 160 | ### Step 1: 统计生成剧本 |
| 161 | |
| 162 | ```python |
| 163 | generated_style = { |
| 164 | 'sentence': analyze_sentence_length(generated_script), |
| 165 | 'dialogue': analyze_dialogue_ratio(generated_script), |
| 166 | 'visual': analyze_visual_markers(generated_script), |
| 167 | 'wanwen': analyze_wanwen_keywords(generated_script), |
| 168 | 'rhythm': analyze_rhythm(generated_script) |
| 169 | } |
| 170 | ``` |
| 171 | |
| 172 | ### Step 2: 统计参考剧本 |
| 173 | |
| 174 | ```python |
| 175 | reference_styles = [ |
| 176 | { |
| 177 | 'sentence': analyze_sentence_length(ref), |
| 178 | 'dialogue': analyze_dialogue_ratio(ref), |
| 179 | 'visual': analyze_visual_markers(ref), |
| 180 | 'wanwen': analyze_wanwen_keywords(ref), |
| 181 | 'rhythm': analyze_rhythm(ref) |
| 182 | } |
| 183 | for ref in reference_scripts |
| 184 | ] |
| 185 | |
| 186 | # 计算平均值 |
| 187 | reference_avg = average(reference_styles) |
| 188 | ``` |
| 189 | |
| 190 | ### Step 3: 对比并生成报告 |
| 191 | |
| 192 | ```python |
| 193 | report = { |
| 194 | 'sentence_analysis': compare_sentence(generated_style, reference_avg), |
| 195 | 'dialogue_analysis': compare_dialogue(generated_style, reference_avg), |
| 196 | 'visual_analysis': compare_visual(generated_style, reference_avg), |
| 197 | 'wanwen_analysis': compare_wanwen(generated_style, reference_avg), |
| 198 | 'rhythm_analysis': compare_rhythm(generated_style, reference_avg) |
| 199 | } |
| 200 | ``` |
| 201 | |
| 202 | ## 输出格式 |
| 203 | |
| 204 | ```markdown |
| 205 | 【风格分析报告】 |
| 206 | |
| 207 | ## 1. 句长分析 |
| 208 | |
| 209 | 生成剧本: |
| 210 | - 平均句长:18字符 ⚠️ |
| 211 | - 短句比例:20% ⚠️ |
| 212 | - 中句比例:60% ✓ |
| 213 | - 长句比例:20% ⚠️ |
| 214 | |
| 215 | 参考剧本: |
| 216 | - 平均句长:12字符 |
| 217 | - 短句比例:35% |
| 218 | - 中句比例:55% |
| 219 | - 长句比例:10% |