123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #include "OTGrammar.h"
- autoOTGrammar OTGrammar_create_NoCoda_grammar () {
- try {
- OTGrammarCandidate candidate;
- OTGrammarTableau tableau;
- OTGrammarConstraint constraint;
- autoOTGrammar me = Thing_new (OTGrammar);
- my constraints = NUMvector <structOTGrammarConstraint> (1, my numberOfConstraints = 2);
- constraint = & my constraints [1];
- constraint -> name = Melder_dup (U"N\\s{O}C\\s{ODA}");
- constraint -> ranking = 100.0;
- constraint -> plasticity = 1.0;
- constraint = & my constraints [2];
- constraint -> name = Melder_dup (U"P\\s{ARSE}");
- constraint -> ranking = 90.0;
- constraint -> plasticity = 1.0;
- my tableaus = NUMvector <structOTGrammarTableau> (1, my numberOfTableaus = 2);
- tableau = & my tableaus [1];
- tableau -> input = Melder_dup (U"pat");
- tableau -> candidates = NUMvector <structOTGrammarCandidate> (1, tableau -> numberOfCandidates = 2);
- candidate = & tableau -> candidates [1];
- candidate -> output = Melder_dup (U"pa");
- candidate -> marks = INTVECzero (candidate -> numberOfConstraints = 2);
- candidate -> marks [2] = 1;
- candidate = & tableau -> candidates [2];
- candidate -> output = Melder_dup (U"pat");
- candidate -> marks = INTVECzero (candidate -> numberOfConstraints = 2);
- candidate -> marks [1] = 1;
- tableau = & my tableaus [2];
- tableau -> input = Melder_dup (U"pa");
- tableau -> candidates = NUMvector <structOTGrammarCandidate> (1, tableau -> numberOfCandidates = 1);
- candidate = & tableau -> candidates [1];
- candidate -> output = Melder_dup (U"pa");
- candidate -> marks = INTVECzero (candidate -> numberOfConstraints = 2);
- OTGrammar_checkIndex (me.get());
- OTGrammar_newDisharmonies (me.get(), 0.0);
- return me;
- } catch (MelderError) {
- Melder_throw (U"NoCoda grammar not created.");
- }
- }
|