npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

qb-answer-checker

v1.1.3

Published

A package to automatically check/judge answers against quizbowl answerlines.

Downloads

142

Readme

QB Answer Checker

A package to automatically check/judge answers against quizbowl answerlines. Mostly used in conjunction with qbreader to automatically check answers.

Usage

Import the checkAnswer function as the default import from src/check-answer.js:

import checkAnswer from "./src/check-answer.js";
checkAnswer("<b><u>1921</u></b>", 1921);
// output: { directive: 'accept', directedPrompt: undefined }

Alternatively, use a CDN like JSDelivr to serve the site to a browser:

import checkAnswer from "https://cdn.jsdelivr.net/npm/qb-answer-checker/dist/main.mjs";

Answerline Specification

This section specifies the kind of (quizbowl) answerlines that the program is designed to parse.

Answerlines should be formatted as follows:

<main section> [<sub-section>] [<sub-section>]? ...

where each section is a string of clauses separated by semicolons of the form:

(<special directives>;)? <clause> (; <clause>; ...)?

where each clause is a string of answers separated by the word "or" of the form:

<directive>? (on)? <answer>((or|,) <answer>(or|,) <answer> ...)? (by asking|with <directed prompt>)?

Deprecated: answers can also be separated by commas instead of "or", but this is deprecated and serves mostly to support old answerlines.

Each directive should be one of:

  • "accept"
  • "prompt"
  • "reject"
  • "anti-prompt"
    • some sets use "antiprompt" (no hyphen)

and "on" and "by asking/with" are optional and indicate that there should be a directed prompt.

Special Directives

Special directives should be one of the following and affect the main answerline only:

  • "accept either" or "accept any": accept any individual word of the main answer
    • For example, if the entire answerline is <b><u>Grover Underwood</u></b> [accept either], then "Grover", "Underwood", and "Grover Underwood" would be accepted.
  • "prompt on partial": prompt on any individual word of the main answer
    • For example: <b><u>John</u></b> [prompt on partial] would prompt on "John" and "John Smith", but not "John Smithson".

Note: special directives should be the first phrase in the sub-answerline, but this program will recognize them anywhere in the sub-answerline.

Additional Info

For more information about how answerlines should be formatted, see https://minkowski.space/quizbowl/manuals/style/answerlines.html. Note that the linked guide is more useful for explaining how answerlines should be formatted from a sylistic/quizbowl sense, while this specification only describes how they should be formatted in a way that computers can understand.