optimality
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Optimality

version

Optimality is a TypeScript package which implements common constraints from Optimality Theory and provides a clear, typed interface for reasoning about them.

const input = "hen"
const candidates = [{
    word: "hen",
    correspondence: [0, 1, 2]
}, {
    word: "he",
    correspondence: [0, 1, null]
}]
const constraints = [MAX, NOCODA]
const result = EVAL(input, candidates, constraints)

Installation

For Yarn:

$ yarn add optimality

For NPM:

$ npm install optimality

Constraints

  • NOCODA
  • ONSET
  • MAX
  • NODORSAL
  • NOCORONAL
  • NOGLOTTAL

Types

Type Meaning
word (From tipa) A group of syllables and the end result of parsing.
markedness_constraint Any function which takes a candidate word and returns the number of violations.
faithfulness_constraint Any function which takes an input word, a candidate word, and a correspondence between the two and returns the number of violations.
correspondence A mapping between two words. An array of number or null values where the index marks the index into the input word and the value marks the corresponding index into the output word, if it exists.

/optimality/

    Package Sidebar

    Install

    npm i optimality

    Weekly Downloads

    0

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    12.4 kB

    Total Files

    10

    Last publish

    Collaborators

    • dustinnewman