syntax-prosody-ot / main

A webapp for the syntax-prosody analyst working in Optimality Theory, with automated Gen, Con and Eval. Download build files from syntax-prosody-ot/build
https://spot.sites.ucsc.edu/
GNU General Public License v2.0
12 stars 2 forks source link

Automated testing for other alignment constraints #486

Open jbellik opened 3 years ago

jbellik commented 3 years ago

Create an html file with Mocha tests for:

Align left/right Focus Align left/right lexical item

jbellik commented 3 years ago

Let stree = [a.foc [b.foc [c.foc]]], where all terminal nodes have foc:true Then: alignFocLeft(stree, {(a.foc (b.foc (c.foc)))}, phi) = 0 alignFocRight(stree, {(a.foc (b.foc (c.foc)))}, phi) = 2

alignFocLeft(stree, {(((a.foc) b.foc) c.foc)}, phi) = 2 alignFocRight(stree, {(((a.foc) b.foc) c.foc)}, phi) = 0

alignFocLeft(stree, {(a.foc b.foc c.foc)}, phi) = 2 alignFocRight(stree, {(a.foc b.foc c.foc)}, phi) = 2

alignFocLeft(stree, {a.foc b.foc c.foc}, phi) = 3 alignFocRight(stree, {a.foc b.foc c.foc}, phi) = 3

alignFocLeft(stree, {a.foc {b.foc {c.foc}}}, i) = 0 alignFocRight(stree, {{{a.foc} b.foc} c.foc}, i) = 0 alignFocLeft(stree, {a.foc {b.foc {c.foc}}}, phi) = 3 alignFocRight(stree, {{{a.foc} b.foc} c.foc}, phi) = 3 alignFocLeft(stree, {a.foc {b.foc {c.foc}}}, w) = 0 alignFocRight(stree, {{{a.foc} b.foc} c.foc}, w) = 0

The maximum number of violations is the number of focused terminals in the output. alignFocLeft(stree, {a {b.foc {c}}}, i) = 0 alignFocRight(stree, {{{a} b.foc} c}, i) = 0 alignFocLeft(stree, {a {b.foc {c}}}, phi) = 1 alignFocRight(stree, {{{a} b.foc} c}, phi) = 1 alignFocLeft(stree, {a {b.foc {c.foc}}}, phi) = 2 alignFocRight(stree, {{{a} b.foc} c.foc}, phi) = 2

jbellik commented 3 years ago

Expected results for alignLeftMorpheme(stree, ptree, 'x') (where x is supposed to be aligned all the way left): ptree = {a b c x} --> 4 {a b x c} --> 3 {a x b c} --> 1 {a b c} --> 0

Also test that alignLeftMorpheme can handle a space separated string of morphemes to check for. Expected results for alignLeftMorpheme(stree, ptree, 'x y'): ptree = {a b c x y} --> 3 violations for x and 4 violations for y = 7 violations {x y a b c} --> 0 violations for x and 1 violation for y = 1 violation total {x a b c y} --> 4 total (for y)

Mirror image results should obtain for alignRightMorpheme.