悄悄话置顶笔记:点开为笔记详情 + 留言区(先审后发)+ 100 条模拟祝福评论;去星空看看 → 首页星空页

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-07 02:07:48 +00:00
parent 85cb4a6a14
commit c804214ea9
4 changed files with 194 additions and 19 deletions

27
tools/whcm/build.py Normal file
View File

@@ -0,0 +1,27 @@
"""孕妈悄悄话置顶笔记的 100 条模拟祝福评论(11-07 用户:「评论里按正常评论放上 100 个」)。
lines.txt 一行一条,「||」后面是楼中楼回复(其他孕妈/宝妈)。人设从 cm.json 的 1000 人里挑:主评论用孕期人设、回复混宝妈;
尽量挑在别的帖子下出现少的人。确定性(固定种子),重跑结果不变;只追加/覆盖 c[TARGET],不动其他帖子。"""
import json, random
from collections import Counter
TARGET = 'wh-20260928'
P = 'guangchang/cm.json'
d = json.load(open(P, encoding='utf-8'))
used = Counter(c[0] for k, L in d['c'].items() if k != TARGET for c in L)
rnd = random.Random(20261107)
preg = sorted([i for i, p in enumerate(d['p']) if p[2].startswith('孕')], key=lambda i: (used[i], i))
anyp = sorted(range(len(d['p'])), key=lambda i: (used[i], i))
mains = preg[:200]; rnd.shuffle(mains)
reps = anyp[:300]; rnd.shuffle(reps)
lines = [l.strip() for l in open('tools/whcm/lines.txt', encoding='utf-8') if l.strip()]
assert len(lines) == 100, len(lines)
out, ri = [], 0
for k, l in enumerate(lines):
parts = l.split('||')
likes = max(3, int(520 * (0.965 ** k)) + rnd.randint(-18, 18))
rr = []
for t in parts[1:]:
rr.append([reps[ri], t]); ri += 1
out.append([mains[k], parts[0], likes, rr])
d['c'][TARGET] = out
json.dump(d, open(P, 'w', encoding='utf-8'), ensure_ascii=False, separators=(',', ':'))
print('ok', len(out), 'replies', ri)