Proceedings: GI 2017

Recognizing Handwritten Source Code

Qiyu Zhi (University of Notre Dame), Ronald Metoyer (University of Notre Dame)

Proceedings of Graphics Interface 2017: Edmonton, Alberta, 16-19 May 2017, 163 - 170

DOI 10.20380/GI2017.21

  • BibTex

    author = {Zhi, Qiyu and Metoyer, Ronald},
    title = {Recognizing Handwritten Source Code},
    booktitle = {Proceedings of Graphics Interface 2017},
    series = {GI 2017},
    year = {2017},
    issn = {0713-5424},
    isbn = {978-0-9947868-2-1},
    location = {Edmonton, Alberta},
    pages = {163 -- 170},
    numpages = {8},
    doi = {10.20380/GI2017.21},
    publisher = {Canadian Human-Computer Communications Society / Soci{\'e}t{\'e} canadienne du dialogue humain-machine},
    keywords = {programming, handwriting recognition, touch screen, source code, python},


Supporting programming on touchscreen devices requires effective text input and editing methods. Unfortunately, the virtual keyboard can be inefficient and uses valuable screen space on already small devices. Recent advances in stylus input make handwriting a potentially viable text input solution for programming on touchscreen devices. The primary barrier, however, is that handwriting recognition systems are built to take advantage of the rules of natural language, not those of a programming language. In this paper, we explore this particular problem of handwriting recognition for source code. We collect and make publicly available a dataset of handwritten Python code samples from 15 participants and we characterize the typical recognition errors for this handwritten Python source code when using a state-of-the-art handwriting recognition tool. We present an approach to improve the recognition accuracy by augmenting a handwriting recognizer with the programming language grammar rules. Our experiment on the collected dataset shows an 8.6% word error rate and a 3.6% character error rate which outperforms standard handwriting recognition systems and compares favorably to typing source code on virtual keyboards.