collapse-score-lite 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ include README.md
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.4
2
+ Name: collapse-score-lite
3
+ Version: 0.1.0
4
+ Summary: Yuanlong causal-chain outcome-label (energy collapse) text evaluation and best-candidate selection module
5
+ Home-page: https://pypi.org/project/collapse-score-lite/
6
+ Author: Yuanlong
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Natural Language :: Chinese (Simplified)
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: jieba>=0.42.1
13
+
14
+ # collapse-score-lite
15
+
16
+ 元龙因果链 - 因果配平第四方程 - 果标签(能量坍塌)文本检测与最佳遴选模块。
17
+
18
+ ## 功能
19
+
20
+ - 对候选中文文本进行"果标签"规范度评分(0-100)
21
+ - 拦截包含 `|` 占位符的文本(判无效)
22
+ - 检测意志主体挂载、主观程度词、转折骨架
23
+ - 排查客观实体事件叙事混入
24
+ - 从候选列表中遴选最高分合格文本,或输出详细评估报告
25
+
26
+ ## 安装
27
+
28
+ ```bash
29
+ pip install collapse-score-lite
30
+ ```
31
+
32
+ ## 使用
33
+
34
+ ```python
35
+ from collapse_score_lite import get_best_outcome_label, OutcomeLabelEvaluator
36
+
37
+ candidates = [
38
+ "廉颇不讲信用,而且性格差",
39
+ "廉颇吃了一斗米",
40
+ "廉颇值得信任",
41
+ ]
42
+
43
+ best = get_best_outcome_label(candidates) # 遴选最佳文本
44
+ report = get_best_outcome_label(candidates, return_eval=True) # 详细评估报告
45
+ ```
46
+
47
+ ## 命令行演示
48
+
49
+ ```bash
50
+ python -m collapse_score_lite
51
+ ```
@@ -0,0 +1,38 @@
1
+ # collapse-score-lite
2
+
3
+ 元龙因果链 - 因果配平第四方程 - 果标签(能量坍塌)文本检测与最佳遴选模块。
4
+
5
+ ## 功能
6
+
7
+ - 对候选中文文本进行"果标签"规范度评分(0-100)
8
+ - 拦截包含 `|` 占位符的文本(判无效)
9
+ - 检测意志主体挂载、主观程度词、转折骨架
10
+ - 排查客观实体事件叙事混入
11
+ - 从候选列表中遴选最高分合格文本,或输出详细评估报告
12
+
13
+ ## 安装
14
+
15
+ ```bash
16
+ pip install collapse-score-lite
17
+ ```
18
+
19
+ ## 使用
20
+
21
+ ```python
22
+ from collapse_score_lite import get_best_outcome_label, OutcomeLabelEvaluator
23
+
24
+ candidates = [
25
+ "廉颇不讲信用,而且性格差",
26
+ "廉颇吃了一斗米",
27
+ "廉颇值得信任",
28
+ ]
29
+
30
+ best = get_best_outcome_label(candidates) # 遴选最佳文本
31
+ report = get_best_outcome_label(candidates, return_eval=True) # 详细评估报告
32
+ ```
33
+
34
+ ## 命令行演示
35
+
36
+ ```bash
37
+ python -m collapse_score_lite
38
+ ```
@@ -0,0 +1,234 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ 元龙因果链-因果配平第四方程-果标签(能量坍塌)文本检测与最佳遴选模块
4
+
5
+ 业务职责说明:
6
+ 本模块用于评估与遴选符合“果标签”规范的自然语言文本。通过语法结构分析、词性标注、
7
+ 主观程度词提取以及客观事件/违规符号(如 '|' 占位符)拦截,判定文本是否达到
8
+ “纯粹终极主观能量坍塌态”。
9
+
10
+ 核心判定规则:
11
+ 1. 符号拦截:严格禁止包含 '|' 占位符,一旦存在直接判定为无效(扣100分)。
12
+ 2. 意志主体挂载:需具备清晰的意志主体(如人称代词、专有名词、人名)。
13
+ 3. 纯粹度评估:主观感受词/程度修饰词越纯粹,评分越高;增损转折骨架作为次级扩展。
14
+ 4. 客观事件拦截:严禁混入客观实体动作与事件叙事(如“去了北京”、“买东西”),混入则扣分并判定无效。
15
+ """
16
+
17
+ import os
18
+ from typing import List, Dict, Any, Union
19
+ import jieba
20
+ import jieba.posseg as pseg
21
+
22
+ # 1. 开启 Windows 终端 ANSI 色彩支持
23
+ if os.name == 'nt':
24
+ os.system('')
25
+
26
+ # 2. 抑制 jieba 默认初始化日志输出
27
+ jieba.default_logger.setLevel(60)
28
+
29
+ # 显式定义常用程度词与转折/递进连词
30
+ DEGREE_WORDS = {
31
+ "很", "太", "非常", "特别", "超", "真", "挺", "蛮", "相当",
32
+ "十分", "极其", "过于", "极度", "有些", "有点", "稍微", "格外", "更加", "恶心"
33
+ }
34
+
35
+ CONJUNCTIONS = {"但是", "而且", "并且", "不过", "可是", "然而", "但", "而"}
36
+
37
+ # 常见动作动词与实体名词词性
38
+ ACTION_VERBS = {'去', '来', '买', '卖', '借', '开', '转', '还', '走', '跑', '飞', '看', '写', '做', '吃', '喝', '打'}
39
+ NOUN_TAGS = {'n', 'ns', 'nz', 'vn', 's', 'f'}
40
+ SUBJECT_POS_TAGS = {'nr', 'r', 'n', 'nz', 'nt'}
41
+
42
+
43
+ class OutcomeLabelEvaluator:
44
+ """基于句法特征与程度修饰自动判定的果标签评估器"""
45
+
46
+ def evaluate(self, text: str) -> Dict[str, Any]:
47
+ """评估单条文本的能量坍塌程度与果标签规范度。"""
48
+ if not text or not text.strip():
49
+ return {
50
+ "score": 0,
51
+ "score_explanation": ["[-100分] 输入文本为空。"],
52
+ "is_valid": False
53
+ }
54
+
55
+ score = 0
56
+ explanations = []
57
+
58
+ # 0. 占位符检测(严重违规项拦截)
59
+ has_delimiter = '|' in text
60
+ clean_text = text.replace('|', '').strip()
61
+ if has_delimiter:
62
+ score -= 100
63
+ explanations.append("[-100分] 包含了 '|' 符号,违反通顺的自然语言表达原则。")
64
+
65
+ # 分词与词性标注
66
+ words_with_pos = [(w, t) for w, t in pseg.cut(clean_text)]
67
+
68
+ # 1. 意志主体检测
69
+ has_subject = False
70
+ subject_word = ""
71
+ for w, t in words_with_pos[:3]:
72
+ if t in SUBJECT_POS_TAGS:
73
+ has_subject = True
74
+ subject_word = w
75
+ break
76
+ elif (w.startswith('老') or w.startswith('小')) and len(w) >= 2 and t not in {'a', 'ad', 'd', 'v'}:
77
+ has_subject = True
78
+ subject_word = w
79
+ break
80
+
81
+ if has_subject:
82
+ score += 30
83
+ explanations.append(f"[+30分] 识别到意志主体 '{subject_word}',具备能量挂载目标。")
84
+ else:
85
+ explanations.append("[+0分] 未检测到意志主体,无法挂载无主之果。")
86
+
87
+ # 2. 句法要素抽取
88
+ found_degree_words = [w for w, t in words_with_pos if w in DEGREE_WORDS or t == 'd']
89
+ found_conjunctions = [w for w, t in words_with_pos if w in CONJUNCTIONS or t == 'c']
90
+
91
+ eval_words = []
92
+ for i, (w, t) in enumerate(words_with_pos):
93
+ if w in DEGREE_WORDS or t == 'd':
94
+ eval_words.append(w)
95
+ if i + 1 < len(words_with_pos):
96
+ next_w, next_t = words_with_pos[i + 1]
97
+ if next_t not in {'x', 'c', 'p', 'u', 'ul'}:
98
+ eval_words.append(next_w)
99
+ elif t in {'a', 'ad', 'an', 'ag', 'i', 'l', 'z', 'b', 'e', 'y'}:
100
+ eval_words.append(w)
101
+
102
+ eval_words = list(dict.fromkeys(eval_words))
103
+
104
+ # 3. 客观实体事件排查
105
+ concrete_events = []
106
+ i = 0
107
+ n_len = len(words_with_pos)
108
+ while i < n_len:
109
+ curr_w, curr_t = words_with_pos[i]
110
+
111
+ if curr_w in DEGREE_WORDS or curr_t == 'd':
112
+ i += 1
113
+ continue
114
+
115
+ if curr_w in ACTION_VERBS or curr_t == 'v':
116
+ j = i + 1
117
+ while j < n_len and words_with_pos[j][1] in {'u', 'ul', 'ug', 'uz'}:
118
+ j += 1
119
+
120
+ if j < n_len:
121
+ target_w, target_t = words_with_pos[j]
122
+ if target_t in NOUN_TAGS or target_t in {'m', 'q'}:
123
+ event_phrase = "".join([words_with_pos[k][0] for k in range(i, j + 1)])
124
+ concrete_events.append(event_phrase)
125
+ i = j
126
+ i += 1
127
+
128
+ if concrete_events:
129
+ penalty = len(concrete_events) * 35
130
+ score -= penalty
131
+ explanations.append(f"[-{penalty}分] 混入了客观实体事件叙事({'/'.join(concrete_events)}),违背果标签纯能量挂载原则。")
132
+
133
+ # 4. 能量坍塌纯粹度评估
134
+ has_eval = bool(eval_words or found_degree_words)
135
+
136
+ if has_eval:
137
+ display_eval = '/'.join(eval_words) if eval_words else '/'.join(found_degree_words)
138
+ if has_subject and not found_conjunctions and not concrete_events:
139
+ score += 70
140
+ explanations.append(f"[+70分] 达到纯粹终极主观能量坍塌态(主观感受词[{display_eval}],无转折杂质,极简纯果)。")
141
+ else:
142
+ score += 40
143
+ explanations.append(f"[+40分] 完成主观能量坍塌形态(主观感受词[{display_eval}])。")
144
+ if found_conjunctions:
145
+ score += 15
146
+ explanations.append(f"[+15分] 具备复合增损转折骨架(连接词:{'/'.join(found_conjunctions)}),属于次级多维扩展态。")
147
+ else:
148
+ explanations.append("[+0分] 缺失主观副型描述,未完成主观感受转化。")
149
+
150
+ final_score = max(0, min(100, score))
151
+ # 合格硬性条件:得分>=60、无客观事件、具备主体、**绝对不包含非法占位符**
152
+ is_valid = (final_score >= 60) and (not concrete_events) and has_subject and (not has_delimiter)
153
+
154
+ return {
155
+ "score": final_score,
156
+ "score_explanation": explanations,
157
+ "is_valid": is_valid
158
+ }
159
+
160
+
161
+ def get_best_outcome_label(texts: List[str], group: bool = False, return_eval: bool = False) -> Union[str, List[Dict[str, Any]]]:
162
+ """从候选文本列表中遴选最适合的果标签,或返回详细评估报告。
163
+
164
+ Args:
165
+ texts: 候选文本列表。
166
+ group: 是否聚合返回所有合格标签。
167
+ - True: 以换行符分隔拼接所有合格原文本。
168
+ - False: 仅返回最高分的一条合格原文本。
169
+ return_eval: 是否进入【评估检测分支】。
170
+ - True: 忽略 group,直接返回一个字典列表,详细展现所有输入文本的评分、是否符合、说明。
171
+ - False: 维持文本遴选功能,返回纯字符串。
172
+
173
+ Returns:
174
+ Union[str, List[Dict]]: 根据 return_eval 的状态,返回纯文本或评估结果列表。若需返回文本且无合格项时固定返回 ""。
175
+ """
176
+ if not texts:
177
+ return [] if return_eval else ""
178
+
179
+ evaluator = OutcomeLabelEvaluator()
180
+
181
+ # === 分支 1:返回详细检测评估报告 ===
182
+ if return_eval:
183
+ evaluation_reports = []
184
+ for text in texts:
185
+ res = evaluator.evaluate(text)
186
+ evaluation_reports.append({
187
+ "text": text,
188
+ "score": res["score"],
189
+ "is_valid": res["is_valid"],
190
+ "explanations": res["score_explanation"]
191
+ })
192
+ return evaluation_reports
193
+
194
+ # === 分支 2:遴选文本(原有逻辑) ===
195
+ valid_candidates = []
196
+ for text in texts:
197
+ res = evaluator.evaluate(text)
198
+ if res["is_valid"]:
199
+ valid_candidates.append((text, res["score"]))
200
+
201
+ if not valid_candidates:
202
+ return ""
203
+
204
+ # 按得分降序排列
205
+ valid_candidates.sort(key=lambda x: x[1], reverse=True)
206
+
207
+ if group:
208
+ return "\n".join([item[0] for item in valid_candidates])
209
+ else:
210
+ return valid_candidates[0][0]
211
+
212
+
213
+ if __name__ == "__main__":
214
+ candidates = [
215
+ "廉颇不讲信用,而且性格差",
216
+ "廉颇吃了一斗米",
217
+ "廉颇值得信任",
218
+ "廉颇骁勇善战",
219
+ "廉颇去了赵国"
220
+ ]
221
+
222
+ print("=== 分支A: 遴选最佳文本 (return_eval=False) ===")
223
+ res_single = get_best_outcome_label(candidates, group=False, return_eval=False)
224
+ print("最终遴选结果:", repr(res_single))
225
+
226
+
227
+ print("\n=== 分支B: 详细评估检测报告 (return_eval=True) ===")
228
+ eval_results = get_best_outcome_label(candidates, return_eval=True)
229
+
230
+ import json
231
+ # 以美观的 JSON 格式打印结果
232
+ print(json.dumps(eval_results, ensure_ascii=False, indent=2))
233
+
234
+ __all__ = ['OutcomeLabelEvaluator', 'get_best_outcome_label']
@@ -0,0 +1,232 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ 元龙因果链-因果配平第四方程-果标签(能量坍塌)文本检测与最佳遴选模块
4
+
5
+ 业务职责说明:
6
+ 本模块用于评估与遴选符合“果标签”规范的自然语言文本。通过语法结构分析、词性标注、
7
+ 主观程度词提取以及客观事件/违规符号(如 '|' 占位符)拦截,判定文本是否达到
8
+ “纯粹终极主观能量坍塌态”。
9
+
10
+ 核心判定规则:
11
+ 1. 符号拦截:严格禁止包含 '|' 占位符,一旦存在直接判定为无效(扣100分)。
12
+ 2. 意志主体挂载:需具备清晰的意志主体(如人称代词、专有名词、人名)。
13
+ 3. 纯粹度评估:主观感受词/程度修饰词越纯粹,评分越高;增损转折骨架作为次级扩展。
14
+ 4. 客观事件拦截:严禁混入客观实体动作与事件叙事(如“去了北京”、“买东西”),混入则扣分并判定无效。
15
+ """
16
+
17
+ import os
18
+ from typing import List, Dict, Any, Union
19
+ import jieba
20
+ import jieba.posseg as pseg
21
+
22
+ # 1. 开启 Windows 终端 ANSI 色彩支持
23
+ if os.name == 'nt':
24
+ os.system('')
25
+
26
+ # 2. 抑制 jieba 默认初始化日志输出
27
+ jieba.default_logger.setLevel(60)
28
+
29
+ # 显式定义常用程度词与转折/递进连词
30
+ DEGREE_WORDS = {
31
+ "很", "太", "非常", "特别", "超", "真", "挺", "蛮", "相当",
32
+ "十分", "极其", "过于", "极度", "有些", "有点", "稍微", "格外", "更加", "恶心"
33
+ }
34
+
35
+ CONJUNCTIONS = {"但是", "而且", "并且", "不过", "可是", "然而", "但", "而"}
36
+
37
+ # 常见动作动词与实体名词词性
38
+ ACTION_VERBS = {'去', '来', '买', '卖', '借', '开', '转', '还', '走', '跑', '飞', '看', '写', '做', '吃', '喝', '打'}
39
+ NOUN_TAGS = {'n', 'ns', 'nz', 'vn', 's', 'f'}
40
+ SUBJECT_POS_TAGS = {'nr', 'r', 'n', 'nz', 'nt'}
41
+
42
+
43
+ class OutcomeLabelEvaluator:
44
+ """基于句法特征与程度修饰自动判定的果标签评估器"""
45
+
46
+ def evaluate(self, text: str) -> Dict[str, Any]:
47
+ """评估单条文本的能量坍塌程度与果标签规范度。"""
48
+ if not text or not text.strip():
49
+ return {
50
+ "score": 0,
51
+ "score_explanation": ["[-100分] 输入文本为空。"],
52
+ "is_valid": False
53
+ }
54
+
55
+ score = 0
56
+ explanations = []
57
+
58
+ # 0. 占位符检测(严重违规项拦截)
59
+ has_delimiter = '|' in text
60
+ clean_text = text.replace('|', '').strip()
61
+ if has_delimiter:
62
+ score -= 100
63
+ explanations.append("[-100分] 包含了 '|' 符号,违反通顺的自然语言表达原则。")
64
+
65
+ # 分词与词性标注
66
+ words_with_pos = [(w, t) for w, t in pseg.cut(clean_text)]
67
+
68
+ # 1. 意志主体检测
69
+ has_subject = False
70
+ subject_word = ""
71
+ for w, t in words_with_pos[:3]:
72
+ if t in SUBJECT_POS_TAGS:
73
+ has_subject = True
74
+ subject_word = w
75
+ break
76
+ elif (w.startswith('老') or w.startswith('小')) and len(w) >= 2 and t not in {'a', 'ad', 'd', 'v'}:
77
+ has_subject = True
78
+ subject_word = w
79
+ break
80
+
81
+ if has_subject:
82
+ score += 30
83
+ explanations.append(f"[+30分] 识别到意志主体 '{subject_word}',具备能量挂载目标。")
84
+ else:
85
+ explanations.append("[+0分] 未检测到意志主体,无法挂载无主之果。")
86
+
87
+ # 2. 句法要素抽取
88
+ found_degree_words = [w for w, t in words_with_pos if w in DEGREE_WORDS or t == 'd']
89
+ found_conjunctions = [w for w, t in words_with_pos if w in CONJUNCTIONS or t == 'c']
90
+
91
+ eval_words = []
92
+ for i, (w, t) in enumerate(words_with_pos):
93
+ if w in DEGREE_WORDS or t == 'd':
94
+ eval_words.append(w)
95
+ if i + 1 < len(words_with_pos):
96
+ next_w, next_t = words_with_pos[i + 1]
97
+ if next_t not in {'x', 'c', 'p', 'u', 'ul'}:
98
+ eval_words.append(next_w)
99
+ elif t in {'a', 'ad', 'an', 'ag', 'i', 'l', 'z', 'b', 'e', 'y'}:
100
+ eval_words.append(w)
101
+
102
+ eval_words = list(dict.fromkeys(eval_words))
103
+
104
+ # 3. 客观实体事件排查
105
+ concrete_events = []
106
+ i = 0
107
+ n_len = len(words_with_pos)
108
+ while i < n_len:
109
+ curr_w, curr_t = words_with_pos[i]
110
+
111
+ if curr_w in DEGREE_WORDS or curr_t == 'd':
112
+ i += 1
113
+ continue
114
+
115
+ if curr_w in ACTION_VERBS or curr_t == 'v':
116
+ j = i + 1
117
+ while j < n_len and words_with_pos[j][1] in {'u', 'ul', 'ug', 'uz'}:
118
+ j += 1
119
+
120
+ if j < n_len:
121
+ target_w, target_t = words_with_pos[j]
122
+ if target_t in NOUN_TAGS or target_t in {'m', 'q'}:
123
+ event_phrase = "".join([words_with_pos[k][0] for k in range(i, j + 1)])
124
+ concrete_events.append(event_phrase)
125
+ i = j
126
+ i += 1
127
+
128
+ if concrete_events:
129
+ penalty = len(concrete_events) * 35
130
+ score -= penalty
131
+ explanations.append(f"[-{penalty}分] 混入了客观实体事件叙事({'/'.join(concrete_events)}),违背果标签纯能量挂载原则。")
132
+
133
+ # 4. 能量坍塌纯粹度评估
134
+ has_eval = bool(eval_words or found_degree_words)
135
+
136
+ if has_eval:
137
+ display_eval = '/'.join(eval_words) if eval_words else '/'.join(found_degree_words)
138
+ if has_subject and not found_conjunctions and not concrete_events:
139
+ score += 70
140
+ explanations.append(f"[+70分] 达到纯粹终极主观能量坍塌态(主观感受词[{display_eval}],无转折杂质,极简纯果)。")
141
+ else:
142
+ score += 40
143
+ explanations.append(f"[+40分] 完成主观能量坍塌形态(主观感受词[{display_eval}])。")
144
+ if found_conjunctions:
145
+ score += 15
146
+ explanations.append(f"[+15分] 具备复合增损转折骨架(连接词:{'/'.join(found_conjunctions)}),属于次级多维扩展态。")
147
+ else:
148
+ explanations.append("[+0分] 缺失主观副型描述,未完成主观感受转化。")
149
+
150
+ final_score = max(0, min(100, score))
151
+ # 合格硬性条件:得分>=60、无客观事件、具备主体、**绝对不包含非法占位符**
152
+ is_valid = (final_score >= 60) and (not concrete_events) and has_subject and (not has_delimiter)
153
+
154
+ return {
155
+ "score": final_score,
156
+ "score_explanation": explanations,
157
+ "is_valid": is_valid
158
+ }
159
+
160
+
161
+ def get_best_outcome_label(texts: List[str], group: bool = False, return_eval: bool = False) -> Union[str, List[Dict[str, Any]]]:
162
+ """从候选文本列表中遴选最适合的果标签,或返回详细评估报告。
163
+
164
+ Args:
165
+ texts: 候选文本列表。
166
+ group: 是否聚合返回所有合格标签。
167
+ - True: 以换行符分隔拼接所有合格原文本。
168
+ - False: 仅返回最高分的一条合格原文本。
169
+ return_eval: 是否进入【评估检测分支】。
170
+ - True: 忽略 group,直接返回一个字典列表,详细展现所有输入文本的评分、是否符合、说明。
171
+ - False: 维持文本遴选功能,返回纯字符串。
172
+
173
+ Returns:
174
+ Union[str, List[Dict]]: 根据 return_eval 的状态,返回纯文本或评估结果列表。若需返回文本且无合格项时固定返回 ""。
175
+ """
176
+ if not texts:
177
+ return [] if return_eval else ""
178
+
179
+ evaluator = OutcomeLabelEvaluator()
180
+
181
+ # === 分支 1:返回详细检测评估报告 ===
182
+ if return_eval:
183
+ evaluation_reports = []
184
+ for text in texts:
185
+ res = evaluator.evaluate(text)
186
+ evaluation_reports.append({
187
+ "text": text,
188
+ "score": res["score"],
189
+ "is_valid": res["is_valid"],
190
+ "explanations": res["score_explanation"]
191
+ })
192
+ return evaluation_reports
193
+
194
+ # === 分支 2:遴选文本(原有逻辑) ===
195
+ valid_candidates = []
196
+ for text in texts:
197
+ res = evaluator.evaluate(text)
198
+ if res["is_valid"]:
199
+ valid_candidates.append((text, res["score"]))
200
+
201
+ if not valid_candidates:
202
+ return ""
203
+
204
+ # 按得分降序排列
205
+ valid_candidates.sort(key=lambda x: x[1], reverse=True)
206
+
207
+ if group:
208
+ return "\n".join([item[0] for item in valid_candidates])
209
+ else:
210
+ return valid_candidates[0][0]
211
+
212
+
213
+ if __name__ == "__main__":
214
+ candidates = [
215
+ "廉颇不讲信用,而且性格差",
216
+ "廉颇吃了一斗米",
217
+ "廉颇值得信任",
218
+ "廉颇骁勇善战",
219
+ "廉颇去了赵国"
220
+ ]
221
+
222
+ print("=== 分支A: 遴选最佳文本 (return_eval=False) ===")
223
+ res_single = get_best_outcome_label(candidates, group=False, return_eval=False)
224
+ print("最终遴选结果:", repr(res_single))
225
+
226
+
227
+ print("\n=== 分支B: 详细评估检测报告 (return_eval=True) ===")
228
+ eval_results = get_best_outcome_label(candidates, return_eval=True)
229
+
230
+ import json
231
+ # 以美观的 JSON 格式打印结果
232
+ print(json.dumps(eval_results, ensure_ascii=False, indent=2))
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.4
2
+ Name: collapse-score-lite
3
+ Version: 0.1.0
4
+ Summary: Yuanlong causal-chain outcome-label (energy collapse) text evaluation and best-candidate selection module
5
+ Home-page: https://pypi.org/project/collapse-score-lite/
6
+ Author: Yuanlong
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Natural Language :: Chinese (Simplified)
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: jieba>=0.42.1
13
+
14
+ # collapse-score-lite
15
+
16
+ 元龙因果链 - 因果配平第四方程 - 果标签(能量坍塌)文本检测与最佳遴选模块。
17
+
18
+ ## 功能
19
+
20
+ - 对候选中文文本进行"果标签"规范度评分(0-100)
21
+ - 拦截包含 `|` 占位符的文本(判无效)
22
+ - 检测意志主体挂载、主观程度词、转折骨架
23
+ - 排查客观实体事件叙事混入
24
+ - 从候选列表中遴选最高分合格文本,或输出详细评估报告
25
+
26
+ ## 安装
27
+
28
+ ```bash
29
+ pip install collapse-score-lite
30
+ ```
31
+
32
+ ## 使用
33
+
34
+ ```python
35
+ from collapse_score_lite import get_best_outcome_label, OutcomeLabelEvaluator
36
+
37
+ candidates = [
38
+ "廉颇不讲信用,而且性格差",
39
+ "廉颇吃了一斗米",
40
+ "廉颇值得信任",
41
+ ]
42
+
43
+ best = get_best_outcome_label(candidates) # 遴选最佳文本
44
+ report = get_best_outcome_label(candidates, return_eval=True) # 详细评估报告
45
+ ```
46
+
47
+ ## 命令行演示
48
+
49
+ ```bash
50
+ python -m collapse_score_lite
51
+ ```
@@ -0,0 +1,12 @@
1
+ MANIFEST.in
2
+ README.md
3
+ pyproject.toml
4
+ setup.cfg
5
+ setup.py
6
+ collapse_score_lite/__init__.py
7
+ collapse_score_lite/collapse_score_lite.py
8
+ collapse_score_lite.egg-info/PKG-INFO
9
+ collapse_score_lite.egg-info/SOURCES.txt
10
+ collapse_score_lite.egg-info/dependency_links.txt
11
+ collapse_score_lite.egg-info/requires.txt
12
+ collapse_score_lite.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ collapse_score_lite
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,23 @@
1
+ [metadata]
2
+ name = collapse-score-lite
3
+ version = 0.1.0
4
+ description = Yuanlong causal-chain outcome-label (energy collapse) text evaluation and best-candidate selection module
5
+ long_description = file: README.md
6
+ long_description_content_type = text/markdown
7
+ author = Yuanlong
8
+ url = https://pypi.org/project/collapse-score-lite/
9
+ classifiers =
10
+ Programming Language :: Python :: 3
11
+ Operating System :: OS Independent
12
+ Natural Language :: Chinese (Simplified)
13
+
14
+ [options]
15
+ packages = collapse_score_lite
16
+ python_requires = >=3.8
17
+ install_requires =
18
+ jieba>=0.42.1
19
+
20
+ [egg_info]
21
+ tag_build =
22
+ tag_date = 0
23
+
@@ -0,0 +1,3 @@
1
+ from setuptools import setup
2
+
3
+ setup()