Imagine Content is a powerful tool for generating printable, educational worksheets for children. This project provides a flexible and extensible framework for creating a wide variety of math-related exercises, from basic counting to more complex arithmetic problems.
The worksheets are defined programmatically and rendered into HTML to simplify stlying and debugging. During generation these HTML previews are converted into PDFs for easy printing and distribution.
Before you begin, ensure you have the following installed:
- Node.js (which includes npm)
Install the dependencies with the packing manager of your choice:
npm installThis project uses vite for development and vite-node to run generation scripts.
To start the development server and view the worksheets in your browser, run:
npm run devThis will start a local server, and you can navigate to the different worksheet URLs to see them rendered live.
To generate PDF versions of the worksheets, use the generate script:
npm run generateThis will create the PDF files in the dist directory. To run without creating files, use:
npm run generate:dryTo run the test suite, use the test script:
npm run testThe project is organized into the following main directories:
src/lib: Contains core logic and helper functions, such as thePermutationBuilderand labeling utilities.src/partials: Reusable HTML partials, like headers and footers, used across different worksheet pages.src/scripts: Houses the main scripts for generating PDFs (generate-pdf.ts) and other automation tasks.src/worksheets: This is the core directory where each type of worksheet is defined. Each subdirectory here represents a single worksheet type and contains its generator, HTML template, and styles.
Each worksheet module within src/worksheets follows this general structure:
generator.ts: This file exports functions to generate all permutations of a worksheet, create a unique name for each permutation, and generate descriptive labels (metadata).worksheet.html: The HTML template for the worksheet. It contains the basic layout and placeholders for the generated content.worksheet.scss: The SASS file containing the styles specific to that worksheet.worksheet.ts: This is the TypeScript entry point for the worksheet page. It often contains the logic to generate the problems and render them into the HTML template.
Each worksheet generator (generator.ts) is responsible for producing not just the content of the worksheet, but also a set of descriptive metadata. This is handled by the generateLabels function within each generator.
These labels are imported from the edugraph-ts library and provide a standardized way to describe the educational competences addressed for each worksheet using the EduGraph ontology.
This metadata can be used for:
- model training and fine-tuning for classification models
- generating embeddings (e.g. with the EduGraph embedding model)
- using it as metadata in search databases like ElasticSearch
Contributions are particularly welcome and least complicate in the form of new worksheet modules. Please feel free to submit a new module via pull request!
By contributing this way, you not only add to a growing database of worksheets available to everyone forever, but also add to a repository of labeled training data to train open source AI education models.
For all other forms of contributions, it is highly recommended to open a Github issue in advance.
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.