diff --git a/main_voc分析.py b/main_voc分析.py index d7bb86b..0bdd7fa 100644 --- a/main_voc分析.py +++ b/main_voc分析.py @@ -4,7 +4,7 @@ VOC 全流程:合并 → 清洗 → 结构化 → 向量化 →(聚类 ∥ 用法:: # 全流程(--industry 默认 Pet Supplies;写入 sqlite 前默认清理旧库,keep-db不清理) - ./310py/bin/python main_voc分析.py --input-dir 目录 --product "产品名" --keep-db + ./310py/bin/python main_voc分析.py --input-dir '/Users/onesvmwhoops/Cursor_Project/VOC_LLM结构化/cat deterrent indoor ' --product "cat deterrent indoor" --keep-db --industry "行业名" # 断点续跑(步骤 4 起可省略 --product,自动读 voc_structured.sqlite) ./310py/bin/python main_voc分析.py --from-step 5 diff --git a/prompts/extraction/examples.yaml b/prompts/extraction/examples.yaml index f31ceb3..5933340 100644 --- a/prompts/extraction/examples.yaml +++ b/prompts/extraction/examples.yaml @@ -52,7 +52,26 @@ sentiment: Positive category: Price -- instruction: "示例 4 教学:保留关键成分与症状等核心具体词汇。绝不能将带有具体成分/病症的词泛化提取。例如遇到「chicken flavor」(鸡肉风味)或「joint pain」(关节疼痛)时,必须保留核心修饰词,绝不能错误缩减提取为「flavor」或「pain」。" +- instruction: "示例 4 教学:非英语评论(例如西班牙语)输出必须全英文。禁止保留原文非英文片段,先理解语义再用英文短语表达。" + review: "El producto en sí está muy bien, viene con 2 cristales templados y 2 grips para los joycon. Pero es lo que he leido en algunos comentarios, la funda huele como a tabaco jajaja es raro pero es así" + output: + audience: "self" + pain_points: [] + product_feedback: + - aspect: "product" + opinion: "it's fine" + sentiment: Positive + category: Quality + - aspect: "included accessories" + opinion: "comes with 2 tempered glass and 2 grips" + sentiment: Positive + category: Function + - aspect: "case smell" + opinion: "smells like tobacco, strange" + sentiment: Negative + category: Quality + +- instruction: "示例 5 教学:保留关键成分与症状等核心具体词汇。绝不能将带有具体成分/病症的词泛化提取。例如遇到「chicken flavor」(鸡肉风味)或「joint pain」(关节疼痛)时,必须保留核心修饰词,绝不能错误缩减提取为「flavor」或「pain」。" review: "My elderly cat suffers from severe joint pain. But he is very attracted by the chicken flavor of this supplement! It really helps him walk better." output: audience: "elderly cat" diff --git a/prompts/extraction/field_rules.md b/prompts/extraction/field_rules.md index 2fac9a7..7492212 100644 --- a/prompts/extraction/field_rules.md +++ b/prompts/extraction/field_rules.md @@ -1,3 +1,8 @@ +## 语言规则(红线): +- 评论输入可能是英语、西班牙语、法语、德语、日语等**任意语言**。 +- **所有输出字段值**(audience、pain_points 每一条、aspect、opinion)**必须是自然英文**。 +- **禁止**保留原文非英文片段(如 está muy bien、huele como a tabaco、très bon);先理解语义,再用英文短语表达。 + ## 分析要求: 1. audience (为谁购买): diff --git a/prompts/extraction/user_batch.md b/prompts/extraction/user_batch.md index 848c38f..e240876 100644 --- a/prompts/extraction/user_batch.md +++ b/prompts/extraction/user_batch.md @@ -1,3 +1,3 @@ -以下为 {n_keys} 段带前缀的英文评论,每段互相独立。请严格按 system 中的「批量输出格式」返回 JSON,顶层键为 {keys_literal}。 +以下为 {n_keys} 段带前缀的用户评论(可能是任意语言),每段互相独立。所有输出字段值必须为英文。请严格按 system 中的「批量输出格式」返回 JSON,顶层键为 {keys_literal}。 {tagged_input} diff --git a/prompts/loader.py b/prompts/loader.py index eeeaf7a..953fb8d 100644 --- a/prompts/loader.py +++ b/prompts/loader.py @@ -161,7 +161,8 @@ def _report_marker_kwargs( "marker_word_zh": markers[0], "marker_word_category": markers[1], "marker_cluster_names": markers[2], - "marker_report_html": markers[3], + "marker_opportunity_matrix": markers[3], + "marker_report_html": markers[4], "wordcloud_top_n": wf.get("wordcloud_top_n", 180), "word_category_classify_n": wf.get("word_category_classify_n", 180), "outlier_label_zh": rp.get("outlier_label_zh", "未归类"), @@ -283,7 +284,7 @@ def validate_prompt_files() -> List[str]: sch = get_schema() if not word_categories(cfg): errors.append("config.yaml: word_categories 为空") - if len(report_markers(sch)) != 4: + if len(report_markers(sch)) != 5: errors.append("schema.yaml: report.markers 须为 4 项") if not product_feedback_categories(sch): errors.append("schema.yaml: extraction.product_feedback_categories 为空") diff --git a/prompts/report/analysis_requirements.md b/prompts/report/analysis_requirements.md index 5b29c82..177d385 100644 --- a/prompts/report/analysis_requirements.md +++ b/prompts/report/analysis_requirements.md @@ -5,4 +5,14 @@ 2.分受众分析 — 对 top2 受众分别写(1)用户需求(2)正面(3)负面(4)客观(仅用对应 2a/2b stage)。 - **(二)全部用户需求与产品反馈**:1.全部受众需求(3a)、2.正面、3.负面、4.客观(3b 三档); 每个