Building a Compact Math Corpus (2025)

Abstract: This paper introduces the Compact Math Corpus (CMC), a preliminary resource for natural language processing in the mathematics domain. We process three open-access undergraduate textbooks from distinct mathematical areas and annotate them in the CoNLL-U format using a lightweight pipeline based on the spaCy Small model. The structured output enables the extraction of syntactic bigrams and TF-IDF scores, supporting a syntactic-semantic analysis of mathematical sentences.From the annotated data, we construct a classification dataset comprising bigrams potentially representing mathematical concepts, along with representative example sentences. We combine CMC with the conversational corpus UD English EWT and train a logistic regression model with K-fold cross-validation, achieving a minimum macro-F1 score of 0.989. These results indicate the feasibility of automatic concept identification in mathematical texts.The study is designed for easy replication in low-resource settings and to promote sustainable research practices. Our approach offers a viable path to tasks such as parser adaptation, terminology extraction, multiword expression modeling, and improved analysis of mathematical language structures.

## introduction mathematical textbooks, though precise and structured, present unique challenges to standard natural language processing (nlp) tools. their language differs significantly from general-domain english, incorporating symbolic notation, diagrams, and domain-specific terminology. consequently, models trained primarily on non-technical corpora often underperform on this type of texts. recent benchmarks such as mathvista @xcite illustrate these challenges. even advanced vision-language models, for example: gpt-4v, achieve accuracy in the range 50% when tasked with understanding mathematical content (see figure 3 , appendix a). meanwhile, datasets including gsm8k @xcite and math @xcite focus on mathematical problem solving, providing question-answer pairs, but lack the linguistic annotations necessary for syntactic or semantic analysis. other resources have been introduced for the processing of the mathematical language. an example is naturalproofs @xcite , which focuses on theorem proving and alignment of formal and informal proofs, but does not address the broader expository writing found in instructional or pedagogical texts. this scarcity limits the development and evaluation of nlp tools tailored for mathematical language. the compact math corpus (cmc) aims to help bridge this gap by offering a preliminary, automatically annotated resource, not a gold standard, but a practical starting point for linguistic processing in this domain. the cmc is built from three open-access undergraduate textbooks: abstract algebra: theory and applications @xcite , linear algebra (hefferon, 2022), and discrete mathematics: an open introduction @xcite , all sourced from the open math textbook initiative foot_0 . using a computationally lean nlp pipeline based on the spacy small model @xcite , we automatically annotate these texts in the conll-u format foot_1 , capturing both morphological and syntactic features. designed for low-resource and sustainable settings @xcite , our pipeline prioritizes accessibility and replicability. to assess its utility, we extract syntactic bigrams from cmc, combine them with the conversational ud english ewt corpus @xcite , and pair each bigram with a representative sentence from its source cor-pus. we then train a logistic regression model using scikit-learn's logisticregression with k-fold cross-validation. the model achieves a minimum macro-f1 score of 0.989, indicating that cost-effective methods can effectively support the detection of mathematical concepts. we release the annotated corpus and supporting materials on github foot_2 . ## corpus preprocessing and annotation the compact math corpus (cmc) was constructed from the three undergraduate-level textbooks introduced in the previous section, each covering a distinct area of mathematics. all texts are openly licensed and available in pdf format. although l a t e x is generally a more suitable format for mathematical texts due to its richer structural markup @xcite , most educational materials are distributed in pdf format, which aligns better with our goal of scalability. to better understand the trade-offs involved, we processed a matched section from the linear algebra textbook in both l a t e x and pdf formats. the source l a t e x was converted to json using pylatexenc foot_3 , and the pdf using pymupdf foot_4 . both outputs were then passed through the same annotation pipeline, and we extracted compounds foot_5 from the resulting conll-u files. of the total compounds detected, 23 appeared in both formats, 6 were exclusive to l a t e x, and 15 were exclusive to pdf (see figure 1 ). these results indicate that, despite some discrepancies, pdfbased processing yields comparable compound extraction quality, an encouraging outcome given the prevalence and accessibility of pdf materials in educational settings. ## dataset construction to investigate whether syntactic bigrams can help distinguish mathematical language from general english, we constructed a binary classification dataset combining the compact math corpus (cmc) with the ud english web treebank (ewt), leveraging their shared conll-u format. ## identifying mathematical concepts to evaluate whether syntactic bigrams can effectively signal mathematical content, we framed a binary classification task: given a sentence containing a candidate bigram, predict whether it expresses a mathematical concept. the classifier operates solely on text-based features, without access to labels or metadata from the source corpora. ## conclusions and future directions summary of findings. this paper presented the compact math corpus (cmc), a syntactically annotated resource built from open-access instructional materials and processed using a lightweight nlp pipeline based on spacy small and the conll-u format. our goal was to enable structured linguistic analysis of mathematical language in a format that supports downstream applications such as terminology extraction and concept classification. through a comparison of tf-idf bigrams before and after annotation, we confirmed that syntactic information enhances the identification of multiword expressions aligned with core mathematical concepts. furthermore, we constructed a balanced dataset by combining cmc with ud-ewt and found that a non-neural approach was able to effectively distinguish mathematical from general-domain content using only text-based features. these findings indicate that even a nonpretrained, resource-efficient model can accurately detect domain-specific content, provided the input is linguistically enriched and well balanced. the approach is computationally efficient and interpretable, making it a suitable framework for educational or resource-constrained nlp scenarios. although more powerful models may improve generalization on ambiguous input, our results provide evidence that structured features like those in conll-u can support accurate concept classification in controlled settings. future directions in mathematical nlp future work will explore expanding the cmc with additional textbooks across a broader range of mathematical topics, as well as refining the annotation pipeline to improve linguistic coverage. furthermore, the classification task can be extended by incorporating richer context (e.g., surrounding sentences or section-level cues) and testing generalization on unseen technical or scientific domains. developing a small-scale gold-standard evaluation set with human-labeled concept phrases could further support benchmarking and model calibration. an open direction for future research involves integrating symbolic representations, such as formulas or equation labels, with the current linguistic layer remaining an open direction. despite being outside the scope of this initial study, such integration would enable a more comprehensive modeling of mathematical discourse, combining syntactic structure with symbolic reasoning.