23 lines
573 B
TypeScript
23 lines
573 B
TypeScript
import type { Breakpoint } from './types';
|
||
import type { Token } from '../core/types';
|
||
|
||
/**
|
||
* EN 候选断点生成(极简派)
|
||
*
|
||
* 口径:
|
||
* - tokens 仅为 WORD(不包含 SPACE token)
|
||
* - 候选断点只生成在 `pos ∈ [1, N-1]`
|
||
* - kind 固定为 SPACE,priority 固定为 10
|
||
*/
|
||
export function generateEnCandidates(tokens: Token[]): Breakpoint[] {
|
||
const n = tokens.length;
|
||
if (n <= 1) return [];
|
||
|
||
const out: Breakpoint[] = [];
|
||
for (let pos = 1; pos <= n - 1; pos++) {
|
||
out.push({ pos, kind: 'SPACE', priority: 10 });
|
||
}
|
||
return out;
|
||
}
|
||
|