| 1 | /* OTGrammar_ex_NPA.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2005,2007,2009,2011,2012,2015-2020 Paul Boersma |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This code is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | * See the GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | /* |
| 20 | * pb 2002/07/16 GPL |
| 21 | * pb 2007/07/23 constraint plasticity |
| 22 | * pb 2007/08/12 wchar |
| 23 | * pb 2011/03/29 C++ |
| 24 | * pb 2011/07/12 C++ |
| 25 | * pb 2015/06/03 char32 |
| 26 | */ |
| 27 | |
| 28 | #include "OTGrammar.h"cxx . . $ `<file>/gram/OTGrammar.h`/ |
| 29 | |
| 30 | autoOTGrammarcxx . . $ autoOTGrammar# OTGrammar_create_NPA_grammarcxx . . $ OTGrammar_create_NPA_grammar(7ca07e509e4e6648). () { |
| 31 | try { |
| 32 | OTGrammarCandidatecxx . . $ OTGrammarCandidate# candidate; |
| 33 | OTGrammarTableaucxx . . $ OTGrammarTableau# tableau; |
| 34 | OTGrammarConstraintcxx . . $ OTGrammarConstraint# constraint; |
| 35 | autoOTGrammarcxx . . $ autoOTGrammar# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (OTGrammar); |
| 36 | mycxx . . $ `melder/melder.h:44:9`! constraintscxx . . $ structOTGrammar#constraints. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). newvectorzerocxx . . $ newvectorzero(d6d5973469733409). <structOTGrammarConstraintcxx . . $ structOTGrammarConstraint#> (mycxx . . $ `melder/melder.h:44:9`! numberOfConstraintscxx . . $ structOTGrammar#numberOfConstraints. = 3); |
| 37 | constraint = & mycxx . . $ `melder/melder.h:44:9`! constraintscxx . . $ structOTGrammar#constraints. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]; |
| 38 | constraint -> namecxx . . $ structOTGrammarConstraint#name. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (U"*G\\s{ESTURE}"); |
| 39 | constraint -> rankingcxx . . $ structOTGrammarConstraint#ranking. = 102.7; |
| 40 | constraint -> plasticitycxx . . $ structOTGrammarConstraint#plasticity. = 1.0; |
| 41 | constraint = & mycxx . . $ `melder/melder.h:44:9`! constraintscxx . . $ structOTGrammar#constraints. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2]; |
| 42 | constraint -> namecxx . . $ structOTGrammarConstraint#name. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (U"*R\\s{EPLACE} (n, m)"); |
| 43 | constraint -> rankingcxx . . $ structOTGrammarConstraint#ranking. = 100.0; |
| 44 | constraint -> plasticitycxx . . $ structOTGrammarConstraint#plasticity. = 1.0; |
| 45 | constraint = & mycxx . . $ `melder/melder.h:44:9`! constraintscxx . . $ structOTGrammar#constraints. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3]; |
| 46 | constraint -> namecxx . . $ structOTGrammarConstraint#name. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (U"*R\\s{EPLACE} (t, p)"); |
| 47 | constraint -> rankingcxx . . $ structOTGrammarConstraint#ranking. = 112.0; |
| 48 | constraint -> plasticitycxx . . $ structOTGrammarConstraint#plasticity. = 1.0; |
| 49 | mycxx . . $ `melder/melder.h:44:9`! tableauscxx . . $ structOTGrammar#tableaus. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). newvectorzerocxx . . $ newvectorzero(d6d5973469733409). <structOTGrammarTableaucxx . . $ structOTGrammarTableau#> (mycxx . . $ `melder/melder.h:44:9`! numberOfTableauscxx . . $ structOTGrammar#numberOfTableaus. = 2); |
| 50 | tableau = & mycxx . . $ `melder/melder.h:44:9`! tableauscxx . . $ structOTGrammar#tableaus. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]; |
| 51 | tableau -> inputcxx . . $ structOTGrammarTableau#input. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (U"an+pa"); |
| 52 | tableau -> candidatescxx . . $ structOTGrammarTableau#candidates. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). newvectorzerocxx . . $ newvectorzero(d6d5973469733409). <structOTGrammarCandidatecxx . . $ structOTGrammarCandidate#> (tableau -> numberOfCandidatescxx . . $ structOTGrammarTableau#numberOfCandidates. = 2); |
| 53 | candidate = & tableau -> candidatescxx . . $ structOTGrammarTableau#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]; |
| 54 | candidate -> outputcxx . . $ structOTGrammarCandidate#output. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (U"anpa"); |
| 55 | candidate -> markscxx . . $ structOTGrammarCandidate#marks. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). zero_INTVECcxx . . $ zero_INTVEC(dab5d3ef28d6a25). (candidate -> numberOfConstraintscxx . . $ structOTGrammarCandidate#numberOfConstraints. = 3); |
| 56 | candidate -> markscxx . . $ structOTGrammarCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1] = 1; |
| 57 | candidate = & tableau -> candidatescxx . . $ structOTGrammarTableau#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2]; |
| 58 | candidate -> outputcxx . . $ structOTGrammarCandidate#output. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (U"ampa"); |
| 59 | candidate -> markscxx . . $ structOTGrammarCandidate#marks. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). zero_INTVECcxx . . $ zero_INTVEC(dab5d3ef28d6a25). (candidate -> numberOfConstraintscxx . . $ structOTGrammarCandidate#numberOfConstraints. = 3); |
| 60 | candidate -> markscxx . . $ structOTGrammarCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2] = 1; |
| 61 | tableau = & mycxx . . $ `melder/melder.h:44:9`! tableauscxx . . $ structOTGrammar#tableaus. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2]; |
| 62 | tableau -> inputcxx . . $ structOTGrammarTableau#input. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (U"at+ma"); |
| 63 | tableau -> candidatescxx . . $ structOTGrammarTableau#candidates. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). newvectorzerocxx . . $ newvectorzero(d6d5973469733409). <structOTGrammarCandidatecxx . . $ structOTGrammarCandidate#> (tableau -> numberOfCandidatescxx . . $ structOTGrammarTableau#numberOfCandidates. = 2); |
| 64 | candidate = & tableau -> candidatescxx . . $ structOTGrammarTableau#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]; |
| 65 | candidate -> outputcxx . . $ structOTGrammarCandidate#output. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (U"atma"); |
| 66 | candidate -> markscxx . . $ structOTGrammarCandidate#marks. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). zero_INTVECcxx . . $ zero_INTVEC(dab5d3ef28d6a25). (candidate -> numberOfConstraintscxx . . $ structOTGrammarCandidate#numberOfConstraints. = 3); |
| 67 | candidate -> markscxx . . $ structOTGrammarCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1] = 1; |
| 68 | candidate = & tableau -> candidatescxx . . $ structOTGrammarTableau#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2]; |
| 69 | candidate -> outputcxx . . $ structOTGrammarCandidate#output. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (U"apma"); |
| 70 | candidate -> markscxx . . $ structOTGrammarCandidate#marks. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). zero_INTVECcxx . . $ zero_INTVEC(dab5d3ef28d6a25). (candidate -> numberOfConstraintscxx . . $ structOTGrammarCandidate#numberOfConstraints. = 3); |
| 71 | candidate -> markscxx . . $ structOTGrammarCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3] = 1; |
| 72 | OTGrammar_checkIndexcxx . . $ OTGrammar_checkIndex(17bef8f582790df). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 73 | OTGrammar_newDisharmoniescxx . . $ OTGrammar_newDisharmonies(ebbb2d2a494dd028). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.0); |
| 74 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 75 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 76 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Nasal place assimilation grammar not created."); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | autoPairDistributioncxx . . $ autoPairDistribution# OTGrammar_create_NPA_distributioncxx . . $ OTGrammar_create_NPA_distribution(55fbb411edc59193). () { |
| 81 | try { |
| 82 | autoPairDistributioncxx . . $ autoPairDistribution# me = PairDistribution_createcxx . . $ PairDistribution_create(55fbb411edc59193). (); |
| 83 | PairDistribution_addcxx . . $ PairDistribution_add(abae96e3399dd15c). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"at+ma", U"atma", 100); |
| 84 | PairDistribution_addcxx . . $ PairDistribution_add(abae96e3399dd15c). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"at+ma", U"apma", 0); |
| 85 | PairDistribution_addcxx . . $ PairDistribution_add(abae96e3399dd15c). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"an+pa", U"anpa", 20); |
| 86 | PairDistribution_addcxx . . $ PairDistribution_add(abae96e3399dd15c). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"an+pa", U"ampa", 80); |
| 87 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 88 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 89 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Nasal place assimilation distribution not created."); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | /* End of file OTGrammar_ex_NPA.cpp */ |