Spaces:
Running
on
Zero
Running
on
Zero
Update response_processor.py
Browse files- response_processor.py +18 -0
response_processor.py
CHANGED
@@ -1234,6 +1234,18 @@ class ResponseProcessor:
|
|
1234 |
|
1235 |
# 第一步:移除完整的解釋性句子片段
|
1236 |
problematic_fragments = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1237 |
# 處理 "strictly adhered to..." 相關片段
|
1238 |
r'\bstrictly\s+adhered\s+to\s+the\s+(?:critical\s+adherence\s+to\s+input\s+rule|or\s+inferences\s+beyond\s+the\s+explicitly\s+provided\s+information)\.?',
|
1239 |
|
@@ -1246,6 +1258,9 @@ class ResponseProcessor:
|
|
1246 |
# 處理 "avoided speculating..." 片段
|
1247 |
r'\bavoided\s+speculating\s+on\s+object\s+quantities,?\s*spatial\s+relationships,?\s*and\s+atmospheres,?\.?',
|
1248 |
|
|
|
|
|
|
|
1249 |
# 處理更一般的解釋性片段
|
1250 |
r'\b(?:have\s+)?strictly\s+adhered\s+to.*?(?:information|rule)\.?',
|
1251 |
r'\b(?:have\s+)?followed\s+the.*?(?:whitelist|rule)\.?',
|
@@ -1257,6 +1272,9 @@ class ResponseProcessor:
|
|
1257 |
r'\bavoided\s+speculating\b',
|
1258 |
r'\bstrictly\s+adhered\s+to\s+the\b',
|
1259 |
r'\bor\s+inferences\s+beyond\b',
|
|
|
|
|
|
|
1260 |
]
|
1261 |
|
1262 |
cleaned_response = response
|
|
|
1234 |
|
1235 |
# 第一步:移除完整的解釋性句子片段
|
1236 |
problematic_fragments = [
|
1237 |
+
# 處理完整的 "Note that I have..." 破碎句型
|
1238 |
+
r'Note\s+that\s+I\s+have\s*,?\s*avoiding\s+any\s+assumptions.*?natural\s+flow\.?',
|
1239 |
+
|
1240 |
+
# 處理 "avoiding any assumptions I have also" 片段
|
1241 |
+
r'\bavoiding\s+any\s+assumptions\s+I\s+have\s+also\s+and\s+detail\s+accuracy\s+rule.*?\.?',
|
1242 |
+
|
1243 |
+
# 處理 "and their locations. Additionally, I have" 片段
|
1244 |
+
r'\band\s+their\s+locations\.\s*Additionally,?\s*I\s+have\s+and\s+have\s+focused.*?\.?',
|
1245 |
+
|
1246 |
+
# 處理 "using transitional phrases..." 片段
|
1247 |
+
r'\busing\s+transitional\s+phrases\s+and\s+varying\s+sentence\s+structures\s+to\s+create\s+a\s+natural\s+flow\.?',
|
1248 |
+
|
1249 |
# 處理 "strictly adhered to..." 相關片段
|
1250 |
r'\bstrictly\s+adhered\s+to\s+the\s+(?:critical\s+adherence\s+to\s+input\s+rule|or\s+inferences\s+beyond\s+the\s+explicitly\s+provided\s+information)\.?',
|
1251 |
|
|
|
1258 |
# 處理 "avoided speculating..." 片段
|
1259 |
r'\bavoided\s+speculating\s+on\s+object\s+quantities,?\s*spatial\s+relationships,?\s*and\s+atmospheres,?\.?',
|
1260 |
|
1261 |
+
# 處理 "and detail accuracy rule" 片段
|
1262 |
+
r'\band\s+detail\s+accuracy\s+rule,?\s*and\s+their\s+locations\.?',
|
1263 |
+
|
1264 |
# 處理更一般的解釋性片段
|
1265 |
r'\b(?:have\s+)?strictly\s+adhered\s+to.*?(?:information|rule)\.?',
|
1266 |
r'\b(?:have\s+)?followed\s+the.*?(?:whitelist|rule)\.?',
|
|
|
1272 |
r'\bavoided\s+speculating\b',
|
1273 |
r'\bstrictly\s+adhered\s+to\s+the\b',
|
1274 |
r'\bor\s+inferences\s+beyond\b',
|
1275 |
+
r'\band\s+detail\s+accuracy\s+rule\b',
|
1276 |
+
r'\bAdditionally,?\s*I\s+have\s+and\s+have\s+focused\b',
|
1277 |
+
r'\bclear\s+and\s+concise\s+manner,?\s*using\s+transitional\s+phrases\b',
|
1278 |
]
|
1279 |
|
1280 |
cleaned_response = response
|