How the Bareun Spell Checker Works
The spell checking API covers the whole process of detecting errors in text, correcting them, and returning the result together with its grounds. The process has four main stages: detection, correction, explanation, and output. Each stage is described below.
graph TB
subgraph Error_Detection[Error detection]
T1[Automatic spacing correction]
T2[Segmentation-stage error detection]
T3[Out-of-vocabulary word error detection]
T4[Non-standard word check]
end
subgraph Correction
C1[Spacing post-correction]
C2[Conjugation error correction]
C3[Standard word replacement]
C4[Out-of-vocabulary word search correction]
C5[Notation error correction]
end
subgraph Explanation
E1[Attach spacing rule explanation]
E2[Attach phonological and morphological rule explanation]
E3[Attach standard-word explanation based on the Standard Korean Language Dictionary]
E4[Accept out-of-vocabulary word]
end
subgraph Output
O1[JSON]
O2[Web spell checker]
end
Error_Detection --> Correction
Correction --> Explanation
Explanation --> Output
T1 --> C1 --> E1 --> O1
T2 --> C2 --> E2
T3 --> C4 --> C5 --> E2
T4 --> C3 --> E3 --> O1
T3 --> C4 --> E4 --> O1
E2 --> O1
O1 --> O2
Error Detection
The error detection stage finds various kinds of errors in the input text. It performs the following tasks:
- Automatic spacing correction
Automatically detects spacing and attaching errors in the text. - Segmentation-stage error detection
When the morphological analyzer analyzes a word, it uses a segmentation model to split the inside of a word unit (eojeol). This task detects errors made in that splitting.
Where a part that should be split correctly within a word is wrong because of conjugation, contraction, elision, or omission, it is marked as a correction target. - Out-of-vocabulary word error detection
Detects and handles words missing from the dictionary, newly coined words, and typos. - Non-standard word check
Detects words and expressions that are not standard language and marks them as correction candidates.
Correction
In the correction stage, fixes are made based on the detected errors:
- Spacing post-correction
Fixes spacing errors to produce correct word unit boundaries. - Grammar error correction
Corrects wrongly used endings and particles, and conjugated forms of predicates. For example, it correctly converts forms such as "벼르고 벼러" → "벼르고 별러". - Standard word replacement
Replaces non-standard words with standard ones. Example: "글장이" → "글쟁이". - Out-of-vocabulary word search correction
Replaces or corrects words that are not in the dictionary. It suggests suitable word candidates.
Explanation
The explanation stage gives the reasons and grounds for the corrected result. To help users understand the context of a correction, it provides the following information:
-
Attach spacing rule explanation
Explains why the spacing was corrected.
Example: "한글맞춤법, 제 1장 총칙, 제 2 항 문장의 각 단어는 띄어 씀을 원칙으로 한다." (Hangul Orthography, Chapter 1 General Provisions, Article 2: as a rule, each word in a sentence is written separately.) -
Attach phonological and morphological rule explanation
Gives the phonological and morphological grounds for correcting conjugation errors and notation errors.
Example: "벼르고 벼러" → "‘르’로 끝나는 어간 뒤에 어미 ‘-아/-어’가 결합하여 ‘ㅡ’가 탈락하고 ‘ㄹ’이 덧붙는 경우, 바뀐 대로 적는다." (When the ending ‘-아/-어’ attaches to a stem ending in ‘르’, the ‘ㅡ’ drops and an extra ‘ㄹ’ is added, write it as it changes.) -
Attach standard-word explanation based on the Standard Korean Language Dictionary
When a word is corrected to the standard language, it gives an explanation based on the Standard Korean Language Dictionary (표준국어대사전).
Example: '오늘은 철이네서 알타리무 다듬던데.' - ‘알타리무’는 비표준어이고 ‘총각무’가 표준어이다. 이는 고유어 계열의 단어가 생명력을 잃고 그에 대응되는 한자어 계열의 단어가 널리 쓰이면, 한자어 계열의 단어를 표준어로 삼는다는 규정(표준어 사정 원칙 제22항)에 따른 것이다. ‘알무’도 비표준어이다. (Meaning: "알타리무" is non-standard and "총각무" is the standard form. Under the rule that when a native Korean word loses currency and its Sino-Korean counterpart is widely used, the Sino-Korean word is taken as standard (Standard Language Rules, Article 22). "알무" is also non-standard.) -
Accept out-of-vocabulary word
Explains why a word missing from the dictionary was accepted or corrected.
Output
The output stage returns the corrected result together with detailed information:
- JSON output
Outputs the corrected sentence and details in JSON so that developers can post-process them. - Web spell checker
Renders the JSON result so that users can review it visually in a web environment.
The Whole Flow
- Error detection stage: Detects errors in the input text.
- Correction stage: Makes suitable corrections based on the detected errors.
- Explanation stage: Attaches grounds and explanations for the corrected result.
- Output stage: Provides the corrected content as JSON and in a web environment, so that both users and developers can use it easily.