  Automatic spelling correction stands as a pivotal challenge within the ambit
of natural language processing (NLP), demanding nuanced solutions. Traditional
spelling correction techniques are typically only capable of detecting and
correcting non-word errors, such as typos and misspellings. However,
context-sensitive errors, also known as real-word errors, are more challenging
to detect because they are valid words that are used incorrectly in a given
context. The Persian language, characterized by its rich morphology and complex
syntax, presents formidable challenges to automatic spelling correction
systems. Furthermore, the limited availability of Persian language resources
makes it difficult to train effective spelling correction models. This paper
introduces a cutting-edge approach for precise and efficient real-word error
correction in Persian text. Our methodology adopts a structured, multi-tiered
approach, employing semantic analysis, feature selection, and advanced
classifiers to enhance error detection and correction efficacy. The innovative
architecture discovers and stores semantic similarities between words and
phrases in Persian text. The classifiers accurately identify real-word errors,
while the semantic ranking algorithm determines the most probable corrections
for real-word errors, taking into account specific spelling correction and
context properties such as context, semantic similarity, and edit-distance
measures. Evaluations have demonstrated that our proposed method surpasses
previous Persian real-word error correction models. Our method achieves an
impressive F-measure of 96.6% in the detection phase and an accuracy of 99.1%
in the correction phase. These results clearly indicate that our approach is a
highly promising solution for automatic real-word error correction in Persian
text.
