Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace EnglishGrammar

Utilities for prompt generation in English

Functions

Functions

article

  • article(antecedent: string): "an" | "a"
  • Choose the article to use in English noun phrases (a vs an)

    This is only a partial implementation. See https://www.grammar.com/a-vs-an-when-to-use/

    Parameters

    • antecedent: string

      Antecedent

    Returns "an" | "a"

renderNoun

  • renderNoun(count: number | string, singular: string, plural: string): string
  • Render a noun in singular or plural form

    Both the singular and plural form of the noun must be supplied as arguments.

    Rule:

    • 1 -> singular
    • else -> plural (including zero)

    Parameters

    • count: number | string

      Count

    • singular: string

      Singular form

    • plural: string

      Plural form

    Returns string