@cloud411716/fancy-webnovel 4.30.10 → 4.30.11
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.
|
@@ -259,6 +259,27 @@
|
|
|
259
259
|
|
|
260
260
|
注意:这不是词表,是形态过滤器。即使不含这些词,只要 name 仍是事件概括陈述句,也要重写。
|
|
261
261
|
|
|
262
|
+
### 5.1.1 痕迹多样性(硬要求)
|
|
263
|
+
|
|
264
|
+
- 同一批 10 条:同一结尾痕迹字最多 2 条;同一双字后缀最多 2 条。
|
|
265
|
+
- 同一分系累计 20 条:同一结尾字最多 4 条;至少出现 8 种结尾;四字名最多 18 条;至少 2 条五字以上。
|
|
266
|
+
- A/B/C 三种句式都要出现,不能 10 条全是“器物 + 残痕”。
|
|
267
|
+
- 不得原样复用 5.1 的示例名;示例只用于理解形态。
|
|
268
|
+
- 如果本批触发了多样性硬校验,按失败信息重写,不要只换同义词。
|
|
269
|
+
|
|
270
|
+
### 5.1.2 痕迹落地(硬要求)
|
|
271
|
+
|
|
272
|
+
名字里的痕迹必须是 note 里那场事件真实留下的东西:
|
|
273
|
+
|
|
274
|
+
- 名字含“炉”,note 必须出现炉/香炉/炉膛;
|
|
275
|
+
- 名字以“烬”结尾,note 必须有可燃物、灰、烧完或余烬;
|
|
276
|
+
- 名字以“印”结尾,note 必须有印/章/戳/掌印/刻痕等载体;
|
|
277
|
+
- 名字以“契”结尾,note 必须有契/约/欠条/承诺/结清;
|
|
278
|
+
- 名字以“录”结尾,note 必须有册/档/名单/账本;
|
|
279
|
+
- 名字以“香”结尾,note 必须有香/气味/香火。
|
|
280
|
+
|
|
281
|
+
note 没产生的痕迹,不能写进 name。不要为了凑“残/余/赊/印/烬/契/诺/录”换字。
|
|
282
|
+
|
|
262
283
|
对照示范:
|
|
263
284
|
|
|
264
285
|
| 旧(问题版) | 新(痕迹版) |
|
|
@@ -371,6 +392,8 @@ node '{{VALIDATE_SCRIPT}}' '<目标文件>'
|
|
|
371
392
|
逐条检查:
|
|
372
393
|
|
|
373
394
|
0. **命名形态过滤(charging-bar 主风格优先,先于其它所有项)**:名字是不是事件概括陈述句?能不能直接改成“它会XXX”?如果是,废;名字只能是痕迹、印记、边界位置或债契标记。禁用引导词:分钟、刻、一日、一次、满格、最后、持续。
|
|
395
|
+
0.1 **痕迹多样性**:本批 10 条是否用了超过 2 个相同结尾痕迹字?是否超过 2 个相同双字后缀?是否全是四字名、全是“器物 + 残痕”?如果是,重写。
|
|
396
|
+
0.2 **痕迹落地**:名字里的痕迹,能在 note 里指出具体物件或残留吗?如果 note 里根本没有这个痕迹,名字作废。
|
|
374
397
|
1. **回望测试**:遮住 note 只读名字,有画面/疑问吗?看完 note 再回看名字,能产生“原来是这个意思”吗?
|
|
375
398
|
2. **高概念测试**:它是不是只停在“规则必须遵守 / 违反会反噬”?如果是,重写。
|
|
376
399
|
3. **场景测试**:它能不能直接长出一场戏:谁用、对谁用、什么时候不能用、用了之后谁来找他?
|
|
@@ -332,6 +332,26 @@
|
|
|
332
332
|
|
|
333
333
|
注意:这不是词表,是形态过滤器;即使不含这些词,只要仍是事件概括句,也要重写。
|
|
334
334
|
|
|
335
|
+
**多样性(硬要求):**
|
|
336
|
+
|
|
337
|
+
- 同一批 10 条:同一结尾痕迹字最多 2 条;同一双字后缀最多 2 条。
|
|
338
|
+
- 同一分系累计 20 条:同一结尾字最多 4 条;至少 8 种结尾;四字名最多 18 条;至少 2 条五字以上。
|
|
339
|
+
- A/B/C 三种句式都要出现,不能全是“器物 + 残痕”。
|
|
340
|
+
- 不得原样复用示例名。
|
|
341
|
+
|
|
342
|
+
**痕迹落地(硬要求):**
|
|
343
|
+
|
|
344
|
+
名字里的痕迹必须是 note 里那场事件真实留下的东西:
|
|
345
|
+
|
|
346
|
+
- 名字含“炉” → note 必须出现炉/香炉/炉膛。
|
|
347
|
+
- 名字以“烬”结尾 → note 必须有可燃物、灰、烧完或余烬。
|
|
348
|
+
- 名字以“印”结尾 → note 必须有印/章/戳/掌印/刻痕等载体。
|
|
349
|
+
- 名字以“契”结尾 → note 必须有契/约/欠条/承诺/结清。
|
|
350
|
+
- 名字以“录”结尾 → note 必须有册/档/名单/账本。
|
|
351
|
+
- 名字以“香”结尾 → note 必须有香/气味/香火。
|
|
352
|
+
|
|
353
|
+
note 没产生的痕迹,不能写进 name。
|
|
354
|
+
|
|
335
355
|
**对照:**
|
|
336
356
|
|
|
337
357
|
| 旧(事件摘要) | 新(痕迹) |
|
package/package.json
CHANGED
|
@@ -136,6 +136,8 @@ export const BUILTIN_STYLES = [
|
|
|
136
136
|
forbidden: ['纯工具名词直接入库', '无边界修饰的机务段/信号楼/电梯/业委会/快递柜', '裸载体当名字'],
|
|
137
137
|
trace_hints: ['隅', '痕', '烬', '残', '余', '赊', '契', '诺', '印', '留', '封', '录'],
|
|
138
138
|
trace_forbidden: ['分钟', '刻', '一日', '一次', '满格', '最后', '持续'],
|
|
139
|
+
trace_diversity: ['同一批 10 条:同一结尾痕迹字最多 2 条,同一双字后缀最多 2 条', '同一分系累计 20 条:同一结尾字最多 4 条,至少 8 种结尾,四字名最多 18 条,至少 2 条五字以上', 'A/B/C 三种句式都要出现,不能全是器物残痕', '不得原样复用示例名'],
|
|
140
|
+
trace_grounding: ['名字里的痕迹必须是 note 里那场事件真实留下的东西', '名字含炉→note 必须出现炉;名字以烬结尾→note 必须有可燃物/灰/烧完', '名字以印/契/录/香结尾→note 必须有对应的印痕/契约/册档/气味'],
|
|
139
141
|
tone: '日常、冷静、略带荒诞',
|
|
140
142
|
},
|
|
141
143
|
lexicon: {
|
|
@@ -351,6 +351,144 @@ export function chargingBarNameFormProblem(records, primaryStyleKey = '') {
|
|
|
351
351
|
+ '。charging-bar 主风格下,名字只能是事件结束后留下的痕迹/印记/边界/债契(如灯烬留愿、站牌余诺、炉底残签),不能是动作+时长、条件+结果、状态+动作或直白交易描述。事件、时长、效果、代价全部移入 note。请重写这些 name 后重新写入目标文件。';
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
+
|
|
355
|
+
/** 统计一列字符串的出现次数,保持首次出现顺序。 */
|
|
356
|
+
function countNameValues(values) {
|
|
357
|
+
const counts = new Map();
|
|
358
|
+
for (const value of values) {
|
|
359
|
+
const key = String(value || '');
|
|
360
|
+
if (!key) continue;
|
|
361
|
+
counts.set(key, (counts.get(key) || 0) + 1);
|
|
362
|
+
}
|
|
363
|
+
return counts;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/** 按 Unicode 码点计数,避免把代理对算成两个字符。 */
|
|
367
|
+
function nameLength(value) {
|
|
368
|
+
return [...String(value || '')].length;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* charging-bar 主风格的“痕迹多样性”底:形态对了还不够,同一个分系里不能
|
|
373
|
+
* 反复用同一套后缀。历史名由调用方传入,这样 20 条分系可以跨批次累计。
|
|
374
|
+
*/
|
|
375
|
+
export function chargingBarNameDiversityProblem(records, primaryStyleKey = '', options = {}) {
|
|
376
|
+
if (String(primaryStyleKey || '') !== 'charging-bar') return '';
|
|
377
|
+
const current = (Array.isArray(records) ? records : [])
|
|
378
|
+
.filter((record) => String(record && record.kind || '') === 'ability_name')
|
|
379
|
+
.map((record) => String(record && record.name || '').trim())
|
|
380
|
+
.filter(Boolean);
|
|
381
|
+
const historical = (Array.isArray(options.historical) ? options.historical : [])
|
|
382
|
+
.map((name) => String(name || '').trim())
|
|
383
|
+
.filter(Boolean);
|
|
384
|
+
const all = [...historical, ...current];
|
|
385
|
+
if (all.length < 10) return '';
|
|
386
|
+
|
|
387
|
+
const endings = countNameValues(all.map((name) => name.slice(-1)));
|
|
388
|
+
const suffixes = countNameValues(all.map((name) => name.slice(-2)));
|
|
389
|
+
const maxSameEnding = Math.max(2, Math.ceil(all.length * 0.2));
|
|
390
|
+
const maxSameSuffix = Math.max(2, Math.ceil(all.length * 0.15));
|
|
391
|
+
const minEndings = Math.max(4, Math.ceil(all.length * 0.4));
|
|
392
|
+
const problems = [];
|
|
393
|
+
|
|
394
|
+
for (const [ending, count] of endings) {
|
|
395
|
+
if (count > maxSameEnding) {
|
|
396
|
+
problems.push(`结尾字「${ending}」${count} 条(上限 ${maxSameEnding})`);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
for (const [suffix, count] of suffixes) {
|
|
400
|
+
if (count > maxSameSuffix) {
|
|
401
|
+
problems.push(`双字后缀「${suffix}」${count} 条(上限 ${maxSameSuffix})`);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (endings.size < minEndings) {
|
|
405
|
+
problems.push(`结尾字只有 ${endings.size} 种(至少 ${minEndings} 种)`);
|
|
406
|
+
}
|
|
407
|
+
if (all.length >= 20) {
|
|
408
|
+
const fourChar = all.filter((name) => nameLength(name) === 4).length;
|
|
409
|
+
const maxFourChar = Math.ceil(all.length * 0.9);
|
|
410
|
+
if (fourChar > maxFourChar) {
|
|
411
|
+
problems.push(`四字名 ${fourChar}/${all.length} 条(上限 ${maxFourChar} 条)`);
|
|
412
|
+
}
|
|
413
|
+
const longNames = all.filter((name) => nameLength(name) >= 5).length;
|
|
414
|
+
const minLongNames = Math.max(2, Math.ceil(all.length * 0.1));
|
|
415
|
+
if (longNames < minLongNames) {
|
|
416
|
+
problems.push(`五字以上名字只有 ${longNames} 条(至少 ${minLongNames} 条)`);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (!problems.length) return '';
|
|
420
|
+
|
|
421
|
+
const offenders = current.filter((name) => {
|
|
422
|
+
const ending = name.slice(-1);
|
|
423
|
+
const suffix = name.slice(-2);
|
|
424
|
+
return (endings.get(ending) || 0) > maxSameEnding
|
|
425
|
+
|| (suffixes.get(suffix) || 0) > maxSameSuffix;
|
|
426
|
+
});
|
|
427
|
+
return '命名多样性不合格:' + problems.join(';')
|
|
428
|
+
+ (offenders.length
|
|
429
|
+
? '。本批需要重写:' + [...new Set(offenders)].slice(0, 8).map((name) => `「${name}」`).join('、')
|
|
430
|
+
: '')
|
|
431
|
+
+ '。同一个分系内不能反复用同一套痕迹后缀;请混用器物残痕、边界错位、债契遗存三种句式,并让四字名和五字以上名字都有。';
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** 每种痕迹后缀必须能由名字里的载体产生;这里只拦明显不可能的搭配。 */
|
|
435
|
+
const CHARGING_BAR_TRACE_SEMANTICS = {
|
|
436
|
+
烬: { allow: /(灯|烛|香|炉|炭|纸|烟|柴|煤|签|灶|火)/, label: '可燃物或火源' },
|
|
437
|
+
印: { allow: /(印|章|戳|牌|票|锁|纸|墨|笔|漆|封|捕|掌|指|刻|烙|痕|契|图|炉|灶|台|门|墙|石|木|铁|盖|压|钳|铲|带|布|衣|绳|灰|炭|火|画)/, label: '可留下印记的载体' },
|
|
438
|
+
香: { allow: /(香|花|汤|茶|饭|味|气|炉|供|包|蒸|煮)/, label: '有气味或香火的载体' },
|
|
439
|
+
录: { allow: /(谱|册|簿|档|榜|班|名|账|籍|录)/, label: '册、档或名单类载体' },
|
|
440
|
+
契: { allow: /(锁|绳|谱|票|约|契|注|牌|封|愿|债|押|字据|合|筹)/, label: '契约或债约载体' },
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
/** 名字里出现这些载体时,note 至少要提到其中一个,避免“炉印”写在公交车上。 */
|
|
444
|
+
const CHARGING_BAR_OBJECT_MARKERS = [
|
|
445
|
+
'充电宝', '关东煮', '长命锁', '同心锁', '灶王画像', '封火砖', '长明灯',
|
|
446
|
+
'消防栓', '红栓', '站牌', '邮筒', '井盖', '梯井', '天桥', '绿灯', '白线',
|
|
447
|
+
'探头', '电匣', '地铁', '快递柜', '喇叭', '蒸笼', '报纸', '铅字', '取号机',
|
|
448
|
+
'门禁', '公交卡', '长椅', '车位', '篮筐', '浴池', '隔间', '鱼鳞', '惊堂',
|
|
449
|
+
'登闻鼓', '铁尺', '判词', '令牌', '榜文', '捕票', '锁链', '铜镜', '界石',
|
|
450
|
+
'令箭', '火漆', '警戒线', '路引', '愿井', '祈愿牌', '漂流瓶', '天灯',
|
|
451
|
+
'许愿墙', '蜡烛', '百家衣', '福袋', '红绳', '祈树', '树洞', '纸鹤', '祈带',
|
|
452
|
+
'锦囊', '纸灰', '香炉', '炉盖', '风门', '炉门', '烟道', '炭盆', '封缸',
|
|
453
|
+
'火钳', '冷灶', '炉箅', '灰铲', '烟囱', '炉圈', '煤炉', '灶', '炉', '灯',
|
|
454
|
+
'钟', '秤', '井', '栓', '桥', '柜', '铃', '池', '缸', '砖', '锁', '袋',
|
|
455
|
+
'线', '锣', '鼓', '牌', '票', '封', '纸', '墨', '笔', '镜', '石', '箭',
|
|
456
|
+
'绳', '树', '带', '鹤', '囊', '香', '灰', '炭',
|
|
457
|
+
];
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* charging-bar 主风格的“痕迹落地”底:名字里的痕迹必须能在 note 里找到
|
|
461
|
+
* 对应的物件或残留。这里不做文学判断,只拦“名字和 note 各写一件事”。
|
|
462
|
+
*/
|
|
463
|
+
export function chargingBarNameGroundingProblem(records, primaryStyleKey = '') {
|
|
464
|
+
if (String(primaryStyleKey || '') !== 'charging-bar') return '';
|
|
465
|
+
const bad = [];
|
|
466
|
+
for (const record of Array.isArray(records) ? records : []) {
|
|
467
|
+
if (String(record && record.kind || '') !== 'ability_name') continue;
|
|
468
|
+
const name = String(record && record.name || '').trim();
|
|
469
|
+
const note = String(record && record.note || '');
|
|
470
|
+
if (!name || !note) continue;
|
|
471
|
+
|
|
472
|
+
const ending = name.slice(-1);
|
|
473
|
+
const semantics = CHARGING_BAR_TRACE_SEMANTICS[ending];
|
|
474
|
+
if (semantics) {
|
|
475
|
+
const body = name.slice(0, -1);
|
|
476
|
+
if (!semantics.allow.test(body)) {
|
|
477
|
+
bad.push(`「${name}」的“${ending}”缺少${semantics.label}`);
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const markers = CHARGING_BAR_OBJECT_MARKERS.filter((marker) => name.includes(marker));
|
|
483
|
+
if (markers.length && !markers.some((marker) => note.includes(marker))) {
|
|
484
|
+
bad.push(`「${name}」里的载体“${markers[0]}”在 note 里找不到`);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
if (!bad.length) return '';
|
|
488
|
+
return '名字与 note 没有闭环:' + [...new Set(bad)].slice(0, 8).join('、')
|
|
489
|
+
+ '。名字里的痕迹必须是 note 里那场事件真实留下的东西;note 没产生的痕迹不能写进 name。请重写这些 name,或把 note 里对应的残留写清楚。';
|
|
490
|
+
}
|
|
491
|
+
|
|
354
492
|
/**
|
|
355
493
|
* Generated batches belong to the builtin catalog. A batch may omit `source`
|
|
356
494
|
* (the database defaults it to builtin), but it must not mark entries as
|
|
@@ -1369,6 +1507,19 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
|
|
|
1369
1507
|
taskList.watchTurns(invocation);
|
|
1370
1508
|
|
|
1371
1509
|
const primaryStyleKey = (selectedStyles.find((style) => style.style_type === 'naming') || {}).style_key || '';
|
|
1510
|
+
const acceptedNameHistory = new Map();
|
|
1511
|
+
const nameHistoryKey = (item) => [worldId, item.subkind || '', item.kind || item.mode || ''].join('\u0000');
|
|
1512
|
+
const rememberedNames = (item) => acceptedNameHistory.get(nameHistoryKey(item)) || [];
|
|
1513
|
+
const rememberNames = (item, records) => {
|
|
1514
|
+
if (!item || item.mode !== 'kind' || !NOUN_FORM_KINDS.has(item.kind)) return;
|
|
1515
|
+
const names = (Array.isArray(records) ? records : [])
|
|
1516
|
+
.filter((record) => String(record && record.kind || '') === item.kind)
|
|
1517
|
+
.map((record) => String(record && record.name || '').trim())
|
|
1518
|
+
.filter(Boolean);
|
|
1519
|
+
if (!names.length) return;
|
|
1520
|
+
const key = nameHistoryKey(item);
|
|
1521
|
+
acceptedNameHistory.set(key, [...rememberedNames(item), ...names]);
|
|
1522
|
+
};
|
|
1372
1523
|
const completed = [];
|
|
1373
1524
|
const incomplete = [];
|
|
1374
1525
|
let importedTotal = 0;
|
|
@@ -1401,23 +1552,31 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
|
|
|
1401
1552
|
const records = readJsonlRecords(file);
|
|
1402
1553
|
const nameFormProblem = chargingBarNameFormProblem(records, primaryStyleKey);
|
|
1403
1554
|
if (nameFormProblem) return { ok: false, detail: nameFormProblem };
|
|
1555
|
+
const nameGroundingProblem = chargingBarNameGroundingProblem(records, primaryStyleKey);
|
|
1556
|
+
const nameDiversityProblem = chargingBarNameDiversityProblem(records, primaryStyleKey, {
|
|
1557
|
+
historical: rememberedNames(item),
|
|
1558
|
+
});
|
|
1559
|
+
const nameProblems = [nameGroundingProblem, nameDiversityProblem].filter(Boolean);
|
|
1560
|
+
if (nameProblems.length) return { ok: false, detail: nameProblems.join('\n\n') };
|
|
1404
1561
|
return { ok: true, records };
|
|
1405
1562
|
};
|
|
1406
1563
|
|
|
1407
1564
|
const acceptBatch = async (file, item, groupId) => {
|
|
1565
|
+
const acceptedRecords = readJsonlRecords(file);
|
|
1408
1566
|
try {
|
|
1409
1567
|
await importFile(root, file, { noPrefetch: true });
|
|
1410
1568
|
} catch (err) {
|
|
1411
1569
|
return { ok: false, fatal: true, detail: (err && err.message ? err.message : String(err)) };
|
|
1412
1570
|
}
|
|
1413
1571
|
if (item.mode === 'ability_core' || item.mode === 'rank_ladder') {
|
|
1414
|
-
const imported =
|
|
1572
|
+
const imported = acceptedRecords.length;
|
|
1415
1573
|
item.generated += 1;
|
|
1416
1574
|
item.batches += 1;
|
|
1417
1575
|
item.imported += imported;
|
|
1418
1576
|
importedTotal += imported;
|
|
1419
1577
|
batchCount += 1;
|
|
1420
1578
|
item.remaining = Math.max(0, item.target - item.generated);
|
|
1579
|
+
rememberNames(item, acceptedRecords);
|
|
1421
1580
|
return { ok: true, imported, generated: item.generated };
|
|
1422
1581
|
}
|
|
1423
1582
|
const beforeCount = item.db_existing;
|
|
@@ -1430,6 +1589,7 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
|
|
|
1430
1589
|
batchCount += 1;
|
|
1431
1590
|
item.imported += imported;
|
|
1432
1591
|
item.remaining = Math.max(0, item.target - item.generated);
|
|
1592
|
+
if (imported > 0) rememberNames(item, acceptedRecords);
|
|
1433
1593
|
return { ok: true, imported, generated: item.generated };
|
|
1434
1594
|
};
|
|
1435
1595
|
|
|
@@ -543,6 +543,14 @@ export function stylePromptBlock(styles, selected, { genres = [] } = {}) {
|
|
|
543
543
|
if (rules.forbidden) lines.push('- 禁用写法(不是禁用载体):' + asArray(rules.forbidden).join('、'));
|
|
544
544
|
if (rules.trace_hints) lines.push('- 痕迹引导词(仅用于构思 name):' + asArray(rules.trace_hints).join('、'));
|
|
545
545
|
if (rules.trace_forbidden) lines.push('- 禁用引导词(出现在 name 里即重写):' + asArray(rules.trace_forbidden).join('、'));
|
|
546
|
+
if (rules.trace_diversity) {
|
|
547
|
+
lines.push('- 痕迹多样性(硬要求):');
|
|
548
|
+
for (const item of asArray(rules.trace_diversity)) lines.push(' - ' + item);
|
|
549
|
+
}
|
|
550
|
+
if (rules.trace_grounding) {
|
|
551
|
+
lines.push('- 痕迹落地(硬要求):');
|
|
552
|
+
for (const item of asArray(rules.trace_grounding)) lines.push(' - ' + item);
|
|
553
|
+
}
|
|
546
554
|
if (rules.tone) lines.push('- 语气:' + rules.tone);
|
|
547
555
|
const preferred = asArray(style.lexicon && style.lexicon.preferred);
|
|
548
556
|
const forbidden = asArray(style.lexicon && style.lexicon.forbidden);
|