1.0.2 • Published 4 years ago

optimality v1.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

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

TypeMeaning
word(From tipa) A group of syllables and the end result of parsing.
markedness_constraintAny function which takes a candidate word and returns the number of violations.
faithfulness_constraintAny function which takes an input word, a candidate word, and a correspondence between the two and returns the number of violations.
correspondenceA 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.