Skip to content

Commit

Permalink
[Fix/BAR-259] 특수문자가 포함된 문장의 맞춤법 검사 오류 해결 (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmswl98 authored Feb 24, 2024
1 parent 7a8034a commit 6365e13
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pages/api/spell-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import hanspell from 'hanspell';

import { type SpellCheckResponse, type Suggestion } from '@api/spell/types';

// eslint-disable-next-line no-useless-escape
const REGEX = /[\{\}\[\]\/?.,;:|\)*~`!^\-_+<>@\#$%&\\\=\(\'\"]/gi;
const HTTP_TIMEOUT = 6000;

/**
Expand Down Expand Up @@ -41,6 +43,8 @@ export default function handler(
) {
const { sentence } = req.body;

const sentenceWithoutSymbol = sentence.replace(REGEX, '');

const error = (error: Error) => {
console.error(error);

Expand All @@ -65,7 +69,7 @@ export default function handler(
};

hanspell.spellCheckByDAUM(
sentence,
sentenceWithoutSymbol,
HTTP_TIMEOUT,
spellCheckByDAUM,
() => {},
Expand Down

0 comments on commit 6365e13

Please sign in to comment.