更新换行算法和APP-PUSH

This commit is contained in:
吕新雨
2026-02-10 11:39:33 +08:00
parent f03d36b5e9
commit ee2d9f44ea
105 changed files with 9967 additions and 233 deletions

View File

@@ -0,0 +1,35 @@
import type { Weights } from './types';
/**
* scoring-tiebreak 默认权重(首版写死客户端)
*
* 来源:`设计说明文档/文档换行算法.md v1.2.1` 10.3
*/
export const DEFAULT_WEIGHTS = Object.freeze({
P_EMOTION_SPLIT: 10000,
P_PROTECTED_SPLIT: 10000,
P_WIDOW_WORD: 800,
P_WIDOW_LINE: 500,
P_SHORT_LASTLINE: 300,
P_PARTICLE_ISO: 200,
R_PUNCT_BREAK: 80,
R_SHIFT_BREAK: 60,
R_ACCUM_BREAK: 40,
R_SELF_BREAK: 20,
P_OVER_MAXLEN: 30,
P_TOO_SHORT: 10,
/**
* 预留:情绪词落点强化(文档 7.2 / 10.2G 提到)
* - 为避免偏离 10.3 首版权重,本实现默认置 0不影响结果
* - 若后续需要启用,可通过 overrides 提供非 0 权重,并用 configVersion 管理
*/
R_EMOTION_TAIL: 0,
P_EMOTION_BURIED: 0,
} satisfies Weights);
export function mergeWeights(overrides?: Partial<Weights> | null | undefined): Weights {
if (!overrides) return { ...DEFAULT_WEIGHTS };
return { ...DEFAULT_WEIGHTS, ...overrides };
}