32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import type { Lexicons } from './types';
|
|
|
|
/**
|
|
* scoring-tiebreak 最小词表(首版写死客户端)
|
|
*
|
|
* 来源:`设计说明文档/文档换行算法.md v1.2.1` 第 7 节
|
|
* 原则:少而准(后续通过打点迭代扩充)
|
|
*/
|
|
export const DEFAULT_LEXICONS: Readonly<Lexicons> = Object.freeze({
|
|
emotionPhrasesTC: [],
|
|
emotionPhrasesEN: [],
|
|
protectedPhrases: [],
|
|
|
|
shiftWordsTC: ['但', '可是', '然而', '却', '只是', '偏偏'],
|
|
shiftWordsEN: ['but', 'yet', 'so'],
|
|
|
|
accumWordsTC: ['已经', '一直', '曾经', '终于', '还是', '到现在'],
|
|
accumWordsEN: ['already', 'still', 'even', 'just', 'really'],
|
|
|
|
selfWordsTC: ['你', '我', '自己', '我们', '别人'],
|
|
selfWordsEN: ['you', 'yourself', 'me', 'we'],
|
|
|
|
emotionWordsTC: ['累', '痛', '怕', '孤单', '委屈', '撑', '崩溃', '放弃'],
|
|
emotionWordsEN: ['tired', 'afraid', 'lonely', 'hurt', 'overwhelmed', 'give up'],
|
|
});
|
|
|
|
export function mergeLexicons(overrides?: Partial<Lexicons> | null | undefined): Lexicons {
|
|
if (!overrides) return { ...DEFAULT_LEXICONS };
|
|
return { ...DEFAULT_LEXICONS, ...overrides };
|
|
}
|
|
|