Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Contains string" question tagging script #1

Open
MathyouMB opened this issue Jul 1, 2024 · 1 comment
Open

"Contains string" question tagging script #1

MathyouMB opened this issue Jul 1, 2024 · 1 comment
Assignees

Comments

@MathyouMB
Copy link
Member

MathyouMB commented Jul 1, 2024

Note: I highlight recommend copy pasting this issue description to chatgpt (or equivalent) as this should be something it can handle writting or creating a basis for quickly

It will vastly improve the time it takes to tag questions if we have a script that can add a new tag when a question's body contains a certain substring.

Ex: if a question contains the string "bitstring", give the question the "comp2804-bitstring" tag

Questions live in a folder called src/content/questions

Every question has a index.md file and a question.ts file.

Tags are stored contained on the ```index.md``, ex:

---
title: N/A
path: comp2804/exam-fall-2014/1
type: multiple-choice
author: Michiel Smid
question: comp2804/exam-fall-2014/1/question.ts
tags:
  - comp2804
  - comp2804-exam
---

The question body is stored on question.ts, ex:

import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
A password consists of 13 characters, each character being one of the ten digits $0,1,2,\dots,9$. <br>
		A password must contain exactly one odd digit. How many passwords are there?
`;

const label1 = String.raw`$13 \cdot 5^{12}$`;
const label2 = String.raw`$13 \cdot 5^{13}$`;
const label3 = String.raw`$13 \cdot 9^{12}$`;
const label4 = String.raw`$13 \cdot 5 \cdot 9^{12}$`;

export const question: MultipleChoiceQuestion = {
  body: body,
  options: [
    { label: label1, correct: false },
    { label: label2, correct: true },
    { label: label3, correct: false },
    { label: label4, correct: false },
  ],
};

You should be able to dynamically import each question and check whether question.body contains the desired substring.

The script should look over every single question that is contained in the src/content/questions folder. This folder structure could hypothetically vary in depth within each subfolder.

@JohnLu2004
Copy link
Collaborator

For the method that we're doing it, I'm not sure whether it's actually feasible for the way we're doing things. We usually tag questions based on their chapter sections. Some bitstring questions are from 3.1.1 and others from 4.2.1.

Although I agree that manually vetting each and every index.md file to check whether it has the appropriate tag is grossly time-consuming, it may be more efficient to find questions with similar phrases and put the tags for that question to the other one as well.

@MFarabi619 MFarabi619 self-assigned this Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Unassigned - Todo
Development

No branches or pull requests

3 participants