A Graph-Assisted Post-OCR Framework with Damerau-Levenshtein Spelling Correction for Drug Name Recognition from Pharmaceutical Packaging
Abstract
Medication errors remain a persistent threat to patient safety, with a global prevalence of approximately 3%, rising to 11% in elderly care and 7% in intensive care units. In Indonesia, the large number of BPOM-registered pharmaceutical products heightens drug misidentification risk from look-alike, sound-alike (LASA) names, while conventional OCR pipelines remain limited by heterogeneous layouts, font variation, and brand–generic name ambiguity. This study develops an integrated, lightweight post-OCR framework resolving both character-level OCR errors and brand–generic naming ambiguity without costly large language models. The main contributions are a Damerau-Levenshtein Spelling Correction (DLSC) module correcting character-level errors against a validated drug dictionary, and a Graph Traversal Correction (GTC) mechanism modeling brand–generic relationships as a directed graph for disambiguation. The framework was evaluated on a self-collected, web-scraped dataset of 9,500 Indonesian drug packaging images spanning 3,678 brand labels, split 80:20 at the brand-label level; three pretrained OCR engines (Tesseract, EasyOCR, PaddleOCR) were benchmarked without domain-specific fine-tuning under both CPU and GPU configurations, with the training subset serving only as a consistency check rather than fitting data, since DLSC and GTC are rule-based and undergo no parameter training. PaddleOCR + DLSC + GTC achieved the best performance, raising accuracy from 50.94% (Raw OCR) to 96.13% on training and 96.69% on testing data, with WER reduced to 3.82%/3.44% and CER to 3.64%/3.76%. Paired McNemar statistical testing confirmed GTC’s improvement over DLSC is significant across all three engines, and baseline comparison confirmed this gain stems specifically from explicit transposition modeling rather than generic dictionary correction. GTC added only 0.05–0.06 ms beyond DLSC regardless of CPU or GPU configuration. Findings indicate that combining lightweight edit-distance correction with graph-based disambiguation substantially improves drug-name recognition accuracy under resource-constrained, pretrained-model deployment conditions.
Downloads
References
A. Z. Al Meslamani, “Medication errors during a pandemic: what have we learnt?,” Expert Opin. Drug Saf., vol. 22, no. 2, pp. 115–118, 2023, doi: 10.1080/14740338.2023.2181954.
R. A. Elliott, E. Camacho, D. Jankovic, M. J. Sculpher, and R. Faria, “Economic analysis of the prevalence and clinical and economic burden of medication error in England,” BMJ Qual. Saf., vol. 30, no. 2, pp. 96–105, Feb. 2021, doi: 10.1136/bmjqs-2019-010206.
Badan Pengawas Obat dan Makanan Republik Indonesia, “Cek Produk - Badan Pengawas Obat dan Makanan RI,” https://cekbpom.pom.go.id/.
D. S. Atmaja, R. Y. Saksono, Yulistiani, Suharjono, and E. Zairina, “Evaluation of medication errors in one of the largest public hospital: A retrospective study,” Clin. Epidemiol. Glob. Health, vol. 28, pp. 1–5, Jul. 2024, doi: 10.1016/j.cegh.2024.101640.
T. S. Supapaan, J. Napaporn, R. Ruthirakanok, S. Srichathum, A. Songmuang, and C. Pitchayajittipong, “Look-alike sound-alike (LASA) medication errors in Thai hospitals,” Pharm. Pract. (Granada)., vol. 22, no. 1, Jan. 2024, doi: 10.18549/PharmPract.2024.1.2886.
W. P. Putri, I. Munadhif, M. K. Hasin, N. Rinanto, and R. Y. Adhitya, “Implementasi Optical Character Recognition untuk klasifikasi penempatan obat berdasarkan kelas terapi di apotek,” Jurnal Elektronika dan Otomasi Industri, vol. 11, no. 2, pp. 420–432, Jul. 2024, doi: 10.33795/elkolind.v11i2.5341.
M. Bensouilah, M. Taffar, and E. Boulham, “Efficient End-to-End Deep Learning Model for Algerian Drug Label Recognition,” in Lecture Notes in Networks and Systems, 2024, pp. 93–103. doi: 10.1007/978-3-031-71848-9_9.
P. Rimdusit, P. Aphiromyarnont, S. Phimoltares, and S. Panthuwadeethorn, “Extracting Information from Drug Label Using Image and Text Processing,” in Proceedings - 21st International Joint Conference on Computer Science and Software Engineering, JCSSE 2024, Institute of Electrical and Electronics Engineers Inc., 2024, pp. 377–382. doi: 10.1109/JCSSE61278.2024.10613666.
S. Karthikeyan, A. G. S. De Herrera, F. Doctor, and A. Mirza, “An OCR Post-Correction Approach Using Deep Learning for Processing Medical Reports,” IEEE Transactions on Circuits and Systems for Video Technology, vol. 32, no. 5, pp. 2574–2581, May 2022, doi: 10.1109/TCSVT.2021.3087641.
K. Le Bao, T. T. Hoang Cong, T. N. Hoang Anh, M. V. Duc, T. H. Le Hai, and N. Thoai, “MediFind - A Medicine Detection Framework for Vietnamese Medical Prescription,” in Proceedings - 2023 International Conference on Advanced Computing and Analytics, ACOMPA 2023, Institute of Electrical and Electronics Engineers Inc., 2023, pp. 38–45. doi: 10.1109/ACOMPA61072.2023.00016.
N. Mukazhanov, Z. Alibiyeva, A. Yerimbetova, A. Kassymova, and N. Alibiyeva, “Development of an augmented Damerau-Levenshtein method for correcting spelling errors in Kazakh texts,” Eastern-European Journal of Enterprise Technologies, vol. 5, no. 2(125), pp. 23–33, 2023, doi: 10.15587/1729-4061.2023.289187.
S. Wu and F. Chang, “A dual-engine fusion optical character recognition method for fast identification and key information extraction of drug labels,” Alexandria Engineering Journal, vol. 128, pp. 1027–1036, Sep. 2025, doi: 10.1016/j.aej.2025.05.037.
P. Thetbanthad, B. Sathanarugsawait, and P. Praneetpolgrang, “Automated Redaction of Personally Identifiable Information on Drug Labels Using Optical Character Recognition and Large Language Models for Compliance with Thailand’s Personal Data Protection Act,” Applied Sciences (Switzerland), vol. 15, no. 9, pp. 1–13, May 2025, doi: 10.3390/app15094923.
K. Gromova and V. Elangovan, “Automatic Extraction of Medication Information from Cylindrically Distorted Pill Bottle Labels,” Mach. Learn. Knowl. Extr., vol. 4, no. 4, pp. 852–864, Dec. 2022, doi: 10.3390/make4040043.
A. Ghazaryan, J. Hovhanisyan, A. Kirakosyan, A. Aramyan, and S. Moosa Moghadam, “An Intelligent Web Application for Drug Information Retrieval Using Optical Character Recognition and Deep Learning,” Norwegian Journal of development of the International Science, no. 152, pp. 86–96, Mar. 2025, doi: 10.5281/zenodo.15024999.
K. Almash and A. Indriyanti, “Identifikasi Merek Obat Menggunakan Metode OCR dengan Perbandingan Morphological Opening dan Closing,” Journal of Informatics and Computer Science (JINACS), vol. 3, pp. 494–505, Jun. 2022, doi: 10.26740/jinacs.v3n04.p494-505.
J. Ma, D. Li, Y. Chen, Y. Qiao, H. Zhu, and X. Zhang, “A Knowledge Graph Entity Disambiguation Method Based on Entity-Relationship Embedding and Graph Structure Embedding,” Comput. Intell. Neurosci., vol. 2021, pp. 1–11, 2021, doi: 10.1155/2021/2878189.
M. Nagayi, A. Scaria Khan, T. Frank, R. Swart, and C. Nyirenda, “Evaluating OCR Performance on Food Packaging Labels in South Africa,” in Communications in Computer and Information Science, 2025, pp. 127–143. doi: 10.1007/978-3-032-11733-5_8.
V. K. Soni, V. Shukla, S. R. Tandan, A. Pimpalkar, N. K. Nema, and M. Naik, “Performance Evaluation of Efficient and Accurate Text Detection and Recognition in Natural Scenes Images Using EAST and OCR Fusion,” International Journal of Advanced Computer Science and Applications, vol. 16, no. 1, pp. 445–453, 2025, doi: 10.14569/IJACSA.2025.0160144.
N. Zhao, “WebPII: Benchmarking Visual PII Detection for Computer-Use Agents,” ICLR 2026 Conference Workshop Track, Mar. 2026, doi: 10.48550/arXiv.2603.17357.
J. Feng et al., “Evaluating OCR performance for assistive technology: effects of walking speed, camera placement, and camera type,” Disabil. Rehabil. Assist. Technol., pp. 1–41, 2026, doi: 10.1080/17483107.2026.2673178.
R. R. R and M. Nazeem, “Open-Source OCR Libraries: A Comprehensive Study for Low Resource Language,” Proceedings of the 21st International Conference on Natural Language Processing (ICON), pp. 416–421, Dec. 2024, [Online]. Available: https://aclanthology.org/2024.icon-1.48/
Y. Chaabi and F. Ataa Allah, “Amazigh spell checker using Damerau-Levenshtein algorithm and N-gram,” Journal of King Saud University - Computer and Information Sciences, vol. 34, no. 8, pp. 6116–6124, 2022, doi: 10.1016/j.jksuci.2021.07.015.
S. M. S. Dashti and S. F. Dashti, “Improving the quality of Persian clinical text with a novel spelling correction system,” BMC Med. Inform. Decis. Mak., vol. 24, no. 1, pp. 1–21, 2024, doi: 10.1186/s12911-024-02613-0.
Husni, Y. D. Pramudita, M. Syarief, A. Justitia, and I. O. Suzanti, “Improving Computational Efficiency and Accuracy of Damerau-Levenshtein Distance for Indonesian Spelling Correction using Cosine Similarity,” Journal of Innovation Information Technology and Application (JINITA), vol. 7, no. 2, pp. 305–313, Dec. 2025, doi: 10.35970/jinita.v7i2.2893.
D. Fatah, Y. Negara, N. Nasrulloh, and N. Utami, “Enhancing Sentiment Analysis Accuracy Through Intelligent Spelling Correction Using Damerau-Levenshtein Distance and N-Gram with Random Forest Classifier,” Ingénierie des systèmes d information, vol. 30, no. 10, pp. 2609–2624, Oct. 2025, doi: 10.18280/isi.301008.
H. Cui et al., “A review on knowledge graphs for healthcare: Resources, applications, and promises,” J. Biomed. Inform., vol. 169, pp. 1–14, 2025, doi: 10.1016/j.jbi.2025.104861.
L. Farrugia, L. M. Azzopardi, J. Debattista, and C. Abela, “medicX-KG: a knowledge graph for pharmacists’ drug information needs,” J. Biomed. Semantics, vol. 16, no. 1, pp. 1–27, 2025, doi: 10.1186/s13326-025-00332-7.
P. Perdomo-Quinteiro and A. Belmonte-Hernández, “Knowledge Graphs for drug repurposing: a review of databases and methods,” Brief. Bioinform., vol. 25, no. 6, pp. 1–3, 2024, doi: 10.1093/bib/bbae461.
M. S. Ikrar Musyaffa, N. Yudistira, M. A. Rahman, A. H. Basori, A. B. Firdausiah Mansur, and J. Batoro, “IndoHerb: Indonesia medicinal plants recognition using transfer learning and deep learning,” Heliyon, vol. 10, no. 23, pp. 1–16, 2024, doi: 10.1016/j.heliyon.2024.e40606.
Y.-S. You and Y.-S. Lin, “A Novel Two-Stage Induced Deep Learning System for Classifying Similar Drugs with Diverse Packaging,” Sensors, vol. 23, no. 16, pp. 1–29, 2023, doi: 10.3390/s23167275.
W. Wang, X. Jing, S. Jiang, and Y. Han, “Pill-MSVAE: A Multiscale Variational Autoencoder Based on Internet of Things for Accurate Automatic Drug Identification and Monitoring,” IEEE Internet Things J., vol. 13, no. 11, pp. 22680–22690, 2026, doi: 10.1109/JIOT.2026.3664411.
I. Majid Mohammed and N. Ashidi Mat Isa, “Contrast Limited Adaptive Local Histogram Equalization Method for Poor Contrast Image Enhancement,” IEEE Access, vol. 13, pp. 62600–62632, 2025, doi: 10.1109/ACCESS.2025.3558506.
A. Fawzi, A. Achuthan, and B. Belaton, “Adaptive Clip Limit Tile Size Histogram Equalization for Non-Homogenized Intensity Images,” IEEE Access, vol. 9, pp. 164466–164492, 2021, doi: 10.1109/ACCESS.2021.3134170.
R. Ahmad, S. Naz, and I. Razzak, “Efficient skew detection and correction in scanned document images through clustering of probabilistic hough transforms,” Pattern Recognit. Lett., vol. 152, pp. 93–99, Dec. 2021, doi: 10.1016/j.patrec.2021.09.014.
Z. Zhang, Y. Cheng, J. Suo, L. Bian, and Q. Dai, “INFWIDE: Image and Feature Space Wiener Deconvolution Network for Non-Blind Image Deblurring in Low-Light Conditions,” IEEE Transactions on Image Processing, vol. 32, pp. 1390–1402, 2023, doi: 10.1109/TIP.2023.3244417.
B. Bataineh et al., “A Comprehensive Review on Document Image Binarization,” J. Imaging, vol. 11, no. 5, pp. 1–30, 2025, doi: 10.3390/jimaging11050133.
M. Liao, Z. Zou, Z. Wan, C. Yao, and X. Bai, “Real-Time Scene Text Detection with Differentiable Binarization and Adaptive Scale Fusion,” IEEE Trans. Pattern Anal. Mach. Intell., vol. 45, no. 1, pp. 919–931, 2023, doi: 10.1109/TPAMI.2022.3155612.
Y. Liu, Y. Wang, and H. Shi, “A Convolutional Recurrent Neural-Network-Based Machine Learning for Scene Text Recognition Application,” Symmetry (Basel)., vol. 15, no. 4, pp. 1–17, 2023, doi: 10.3390/sym15040849.
R. Buoy, M. Iwamura, S. Srun, and K. Kise, “Explainable Connectionist-Temporal-Classification-Based Scene Text Recognition,” J. Imaging, vol. 9, no. 11, pp. 1–20, 2023, doi: 10.3390/jimaging9110248.
B. Mohamed Nadjib, B. Meriem, and N. Lamri, “An OCR system optimized for Algerian drug package labels,” Journal of Molecular and Pharmaceutical Sciences, vol. 04, no. 02, pp. 61–70, 2025, [Online]. Available: https://jmps.crsp.dz/wp-content/uploads/2025/12/Article-6-An-ocr.pdf
R. Yamano and T. Shibuya, “Faster Algorithm for Bounded Damerau–Levenshtein Distance,” in Lecture Notes in Computer Science, 2025, pp. 291–303. doi: 10.1007/978-3-032-05228-5_23.
D. Maheswari, D. Putri, and A. Wirdiani, “Implementation of Dictionary Lookup and Damerau-Levenshtein Distance for Correcting Non-Standard Indonesian and English Terms,” Jurnal Ilmiah Merpati (Menara Penelitian Akademika Teknologi Informasi), vol. 13, no. 1, pp. 63–73, May 2025, doi: 10.24843/JIM.2025.v13.i01.p07.
A. Kaufman and A. Klevs, “Adaptive Fuzzy String Matching: How to Merge Datasets with Only One (Messy) Identifying Field,” Political Analysis, vol. 30, pp. 590–596, Oct. 2021, doi: 10.1017/pan.2021.38.
S. Hajbi, O. Amezian, N. E. Moukhi, R. Korchiyne, and Y. Chihab, “Moroccan Arabizi-to-Arabic conversion using rule-based transliteration and weighted Levenshtein algorithm,” Sci. Afr., vol. 23, pp. 1–19, 2024, doi: 10.1016/j.sciaf.2024.e02073.
J. Napaporn, P. Buakaew, P. Suksakornthanawat, S. Sripa, P. Jinatongthai, and T. Supapaan, “Analogous comparison of registered brand name drugs of tablets and capsules commercially available in Thailand: A retrospective study,” PLoS One, vol. 17, no. 10, 2022, doi: 10.1371/journal.pone.0276321.
D. Obraczka and E. Rahm, “Fast Hubness-Reduced Nearest Neighbor Search for Entity Alignment in Knowledge Graphs,” SN Comput. Sci., vol. 3, no. 6, pp. 1–19, 2022, doi: 10.1007/s42979-022-01417-1.
H. Ullah, M. Tanveer, and A. Jan, “Enhancing Handwritten Prescription Recognition with AI-Driven OCR,” Journal of Computing and Biomedical Informatics, vol. 9, no. 2, 2025, [Online]. Available: https://www.jcbi.org/index.php/Main/article/view/1054/734
P. Li, X. Wang, K. Huang, Y. Huang, S. Li, and M. Iqbal, “Multi-Model Running Latency Optimization in an Edge Computing Paradigm,” Sensors, vol. 22, no. 16, pp. 1–17, 2022, doi: 10.3390/s22166097.
J. A. Roldán-Nofuentes, T. S. Sheth, and J. F. Vera-Vera, “Hypothesis Test to Compare Two Paired Binomial Proportions: Assessment of 24 Methods,” Mathematics, vol. 12, no. 2, pp. 1–23, Jan. 2024, doi: 10.3390/math12020190.
S. Mokhtar, Z. Yusof, and H. Sapiri, “Confidence Intervals by Bootstrapping Approach: A Significance Review,” Malaysian Journal of Fundamental and Applied Sciences, vol. 19, no. 1, pp. 30–42, Feb. 2023, doi: 10.11113/mjfas.v19n1.2660.
S. Holm, “Board of the Foundation of the Scandinavian Journal of Statistics A Simple Sequentially Rejective Multiple Test Procedure A Simple Sequentially Rejective Multiple Test Procedure,” Source: Scandinavian Journal of Statistics, vol. 6, no. 2, pp. 65–70, 1979, [Online]. Available: https://www.jstor.org/stable/4615733
Copyright (c) 2026 Fito Satrio, Muhammad Raafi'u Firmansyah, Diah Septiani

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution-ShareAlikel 4.0 International (CC BY-SA 4.0) that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).


.png)
.png)
.png)
.png)
.png)