孕妈悄悄话留言加 39 条孕早期妈妈的话 + 12 条早孕妈妈在胎动/四维留言下的回复

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-07 03:31:56 +00:00
parent e8df9dd389
commit 5f6f7abda3
8 changed files with 88 additions and 7 deletions

View File

@@ -26,6 +26,36 @@ for k, l in enumerate(lines):
for t in parts[1:]:
rr.append([reps[ri], t]); ri += 1
out.append([mains[k], parts[0], likes, rr])
# 11-07 用户:「评论里也加一些孕早期的孕妈,看到别人有胎动也有期待,也有自己的话对孩子说;都要真人感」
# early.txt = 孕 6~13 周人设的留言(回复用孕中晚期/宝妈人设,像过来人);均匀插进前 100 条中间,不全堆在后面
# early_rep.txt = 「原留言开头|早孕妈妈的回复」,挂在已有留言楼里(「看你们说胎动好羡慕」这类)
early_p = sorted([i for i, p in enumerate(d['p']) if 6 <= wk(p) <= 13 and i not in set(reps)], key=lambda i: (used[i], i))
er = random.Random(20261108); er.shuffle(early_p)
ei = 0
for t in [l.strip() for l in open('tools/whcm/early_rep.txt', encoding='utf-8') if l.strip()]:
head, txt = t.split('|', 1)
hit = [c for c in out if c[1].startswith(head)]
assert len(hit) == 1, head
hit[0][3].append([early_p[ei], txt]); ei += 1
early = [l.strip() for l in open('tools/whcm/early.txt', encoding='utf-8') if l.strip()]
eo = []
for k, l in enumerate(early):
parts = l.split('||')
rr = []
for t in parts[1:]:
rr.append([reps[ri], t]); ri += 1
eo.append([early_p[ei], parts[0], 0, rr]); ei += 1
# 插进去:从第 3 条起每隔约 2~3 条放一条早孕的,赞数取前后两条之间
merged = []
step = len(out) / len(eo)
j = 0
for k, c in enumerate(out):
merged.append(c)
while j < len(eo) and k >= 2 + j * step * .96:
e = eo[j]; nxt = out[k + 1][2] if k + 1 < len(out) else 3
e[2] = max(3, (c[2] + nxt) // 2 + rnd.randint(-4, 4)); merged.append(e); j += 1
merged += eo[j:]
out = merged
d['c'][TARGET] = out
json.dump(d, open(P, 'w', encoding='utf-8'), ensure_ascii=False, separators=(',', ':'))
print('ok', len(out), 'replies', ri)
print('ok', len(out), 'replies', ri, 'early', len(eo), 'early-replies', ei - len(eo))