feat(input): expand Araso Han/Eng contractions, acronyms, typo recovery, and fast cursor-tail replacement
This commit is contained in:
parent
51bf664302
commit
f403111256
80 changed files with 1449 additions and 458 deletions
|
|
@ -17,6 +17,7 @@ import {
|
|||
type WritingRegister
|
||||
} from '@d3ro/core/writing-context'
|
||||
import { containsEmoji } from '@d3ro/core/input-intelligence'
|
||||
import { buildModelTypoHints } from '@d3ro/core/typo-correction'
|
||||
|
||||
const logger = getLogger('llm-prompts')
|
||||
|
||||
|
|
@ -455,14 +456,15 @@ export { SUGGESTION_SYSTEM_PROMPT, SUGGESTION_CONTINUE_SYSTEM_PROMPT }
|
|||
* 띄어쓰기·문체·단어 선택은 고치지 않는다. 호출자는 core `validateModelCorrections` 로
|
||||
* 결과를 다시 거른다(모델 출력은 신뢰하지 않는다).
|
||||
*/
|
||||
const TYPO_CHECK_SYSTEM_PROMPT = `사용자가 입력창에 방금 친 문장에서 오타만 찾습니다.
|
||||
const TYPO_CHECK_SYSTEM_PROMPT = `사용자가 입력창에 방금 친 문장에서 오타와 한영 자판 오타를 찾습니다.
|
||||
|
||||
규칙:
|
||||
- 잘못 누른 글자, 빠지거나 겹친 글자, 자모가 뒤바뀐 글자, 틀린 맞춤법 철자처럼 명백한 오타만 고르세요.
|
||||
- 한영키가 잘못 눌린 채 입력된 영단어·한글 단어(예: ㅗ디ㅐ => hello, ㅡㅁ가둥 => markdown, 네갸ㅜㅎ에서 => spring에서, dkssudgktpd => 안녕하세요)도 [한영 자판 변환 참고]와 문맥을 보고 바르게 고치세요.
|
||||
- 띄어쓰기, 문장부호, 말투, 단어 선택, 어순은 고치지 마세요.
|
||||
- 고유명사, 약어, 신조어, 외래어, 일부러 쓴 줄임말·구어체(ㅋㅋ, 넘, 젤 등)는 그대로 두세요.
|
||||
- 확실하지 않으면 고치지 마세요.
|
||||
- 오타마다 한 줄에 "틀린단어 => 고친단어" 형식으로 출력하세요. 단어는 문장에 나온 어절 그대로 쓰세요.
|
||||
- 오타마다 한 줄에 "틀린단어 => 고친단어" 형식으로 출력하세요. 왼쪽에는 [검사할 문장]에 나온 어절 원문을 그대로 쓰세요.
|
||||
- 오타가 없으면 "없음" 한 단어만 출력하세요. 다른 설명은 쓰지 마세요.`
|
||||
|
||||
export function buildTypoCheckPrompt(input: { sentence: string; previous?: string | null }): {
|
||||
|
|
@ -471,8 +473,13 @@ export function buildTypoCheckPrompt(input: { sentence: string; previous?: strin
|
|||
} {
|
||||
const sections: string[] = []
|
||||
const previous = input.previous?.replace(/\s+/gu, ' ').trim()
|
||||
const sentence = input.sentence.replace(/\s+/gu, ' ').trim()
|
||||
if (previous) sections.push('[앞 문맥]', previous.slice(-200), '')
|
||||
sections.push('[검사할 문장]', input.sentence.replace(/\s+/gu, ' ').trim())
|
||||
sections.push('[검사할 문장]', sentence)
|
||||
const layoutHints = buildModelTypoHints(sentence)
|
||||
if (layoutHints.length > 0) {
|
||||
sections.push('', '[한영 자판 변환 참고]', ...layoutHints)
|
||||
}
|
||||
return {
|
||||
systemPrompt: `${SUGGESTION_NO_THINK_PREFIX}\n${TYPO_CHECK_SYSTEM_PROMPT}`,
|
||||
text: sections.join('\n')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue