/** * ## Fill-In-The-Blank Regular Expression Graders * * For the FITB Regex grader, you'll need to be familiar with javascript regular expression syntax. * - Tutorial/Documentation at [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) * - Interactive tool for testing out regexes, really neat. [https://regex101.com/](https://regex101.com/) Make sure to select the "ECMAScript/Javascript" flavor on the left side. * - Tip: Normally, the regex will match against any substring of what the student entered. If you want it to only match the WHOLE thing, use `^` and `$`. For example, if you're looking to match any decimal number `/[\d\.]+` will match `6.2` and `My answer is 6.2`, whereas `^[\d\.]+$` will only match `6.2`. Essentially `^` means "beginning of string" and `$` means "end of string". * * For now, refer to examples of existing graders. More thorough documentation coming. * * @module */ import { AssignedQuestion, GradedQuestion } from "../core/assigned_exams"; import { ResponseKind } from "../response/common"; import { ImmutableGradingResult, QuestionGrader } from "./QuestionGrader"; export type FITBRegexGradingResult = PartialFITBRegexGradingResult | FullFITBRegexGradingResult; type PartialFITBRegexGradingResult = ImmutableGradingResult & { readonly wasBlankSubmission: true; readonly wasInvalidSubmission?: boolean; } | ImmutableGradingResult & { readonly wasBlankSubmission: false; readonly wasInvalidSubmission: true; }; type FullFITBRegexGradingResult = ImmutableGradingResult & { readonly wasBlankSubmission: false; readonly wasInvalidSubmission?: false; readonly itemResults: readonly { matched: boolean; pointsEarned: number; explanation?: string; }[]; }; export type FITBRegexMatcher = { pattern: RegExp | readonly string[] | ((s: string) => boolean); points: number; explanation: string; }; export type FITBRegexRubricItem = { blankIndex: number; points: number; title: string; description: string; patterns: FITBRegexMatcher[]; }; export type FITBRegexGraderSpecification = { readonly grader_kind: "manual_regex_fill_in_the_blank"; readonly rubric: readonly FITBRegexRubricItem[]; }; export declare class FITBRegexGrader implements QuestionGrader<"fill_in_the_blank"> { readonly spec: FITBRegexGraderSpecification; readonly t_response_kinds: "fill_in_the_blank"; private minRubricItemPoints; constructor(spec: FITBRegexGraderSpecification); scale(new_points_possible: number): FITBRegexGrader; isGrader(responseKind: T): this is QuestionGrader; prepare(exam_id: string, question_id: string, spec: FITBRegexGraderSpecification): void; grade(aq: AssignedQuestion<"fill_in_the_blank">): FITBRegexGradingResult; private grade_helper; private single_blank_grade_helper; pointsEarned(gr: FITBRegexGradingResult): number; renderReport(aq: GradedQuestion<"fill_in_the_blank", FITBRegexGradingResult>): string; annotateResponseElem(gq: GradedQuestion<"fill_in_the_blank", FITBRegexGradingResult>, response_elem: JQuery): void; renderStats(aqs: readonly AssignedQuestion<"fill_in_the_blank">[]): string; private getGradedBlanksSubmissions; renderOverview(gqs: readonly GradedQuestion<"fill_in_the_blank", FITBRegexGradingResult>[]): string; } export {};