| 1 | /* OTMulti_ex_metrics.cpp |
| 2 | * |
| 3 | * Copyright (C) 2014-2020,2025,2026 Paul Boersma |
| 4 | * Forked from OTGrammar_ex_metrics.cpp, Copyright (C) 2001-2007,2009,2011,2012 Paul Boersma |
| 5 | * |
| 6 | * This code is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or (at |
| 9 | * your option) any later version. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 14 | * See the GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #include "OTMulti.h"cxx . . $ `<file>/gram/OTMulti.h`/ |
| 21 | |
| 22 | #define WSPcxx . . $ `gram/OTMulti_ex_metrics.cpp:22:9`! 1 |
| 23 | #define FtNonfinalcxx . . $ `gram/OTMulti_ex_metrics.cpp:23:9`! 2 |
| 24 | #define Iambiccxx . . $ `gram/OTMulti_ex_metrics.cpp:24:9`! 3 |
| 25 | #define Parsecxx . . $ `gram/OTMulti_ex_metrics.cpp:25:9`! 4 |
| 26 | #define FootBincxx . . $ `gram/OTMulti_ex_metrics.cpp:26:9`! 5 |
| 27 | #define WFLcxx . . $ `gram/OTMulti_ex_metrics.cpp:27:9`! 6 |
| 28 | #define WFRcxx . . $ `gram/OTMulti_ex_metrics.cpp:28:9`! 7 |
| 29 | #define Main_Lcxx . . $ `gram/OTMulti_ex_metrics.cpp:29:9`! 8 |
| 30 | #define Main_Rcxx . . $ `gram/OTMulti_ex_metrics.cpp:30:9`! 9 |
| 31 | #define AFLcxx . . $ `gram/OTMulti_ex_metrics.cpp:31:9`! 10 |
| 32 | #define AFRcxx . . $ `gram/OTMulti_ex_metrics.cpp:32:9`! 11 |
| 33 | #define Nonfinalcxx . . $ `gram/OTMulti_ex_metrics.cpp:33:9`! 12 |
| 34 | |
| 35 | #define Trochaiccxx . . $ `gram/OTMulti_ex_metrics.cpp:35:9`! 13 |
| 36 | #define FootBimoraiccxx . . $ `gram/OTMulti_ex_metrics.cpp:36:9`! 14 |
| 37 | #define FootBisyllabiccxx . . $ `gram/OTMulti_ex_metrics.cpp:37:9`! 15 |
| 38 | #define Peripheralcxx . . $ `gram/OTMulti_ex_metrics.cpp:38:9`! 16 |
| 39 | #define MainNonfinalcxx . . $ `gram/OTMulti_ex_metrics.cpp:39:9`! 17 |
| 40 | #define HeadNonfinalcxx . . $ `gram/OTMulti_ex_metrics.cpp:40:9`! 18 |
| 41 | #define Clashcxx . . $ `gram/OTMulti_ex_metrics.cpp:41:9`! 19 |
| 42 | #define Lapsecxx . . $ `gram/OTMulti_ex_metrics.cpp:42:9`! 20 |
| 43 | |
| 44 | #define WeightByPositioncxx . . $ `gram/OTMulti_ex_metrics.cpp:44:9`! 21 |
| 45 | #define MoraicConsonantcxx . . $ `gram/OTMulti_ex_metrics.cpp:45:9`! 22 |
| 46 | |
| 47 | #define NUMBER_OF_CONSTRAINTScxx . . $ `gram/OTMulti_ex_metrics.cpp:47:9`! 22 |
| 48 | |
| 49 | constexpr integercxx . . $ integer# MAXIMUM_NUMBER_OF_SYLLABLEScxx . . $ MAXIMUM_NUMBER_OF_SYLLABLES. = 10; |
| 50 | |
| 51 | static const conststring32cxx . . $ conststring32# constraintNamescxx . . $ constraintNames. [1+NUMBER_OF_CONSTRAINTScxx . . $ `gram/OTMulti_ex_metrics.cpp:47:9`!] { 0, |
| 52 | U"WSP", U"FtNonfinal", U"Iambic", U"Parse", U"FootBin", U"WFL", U"WFR", U"Main-L", U"Main-R", U"AFL", U"AFR", U"Nonfinal", |
| 53 | U"Trochaic", U"FtBimor", U"FtBisyl", U"Peripheral", U"MainNonfinal", U"HeadNonfinal", U"*Clash", U"*Lapse", U"WeightByPosition", U"*C\\mu" }; |
| 54 | |
| 55 | static void addCandidatecxx . . $ addCandidate(2ec5403eb536df15). (OTMulticxx . . $ OTMulti# me, conststring32cxx . . $ conststring32# underlyingForm, integercxx . . $ integer# numberOfSyllables, int stress [], |
| 56 | bool footedToTheLeft [], bool footedToTheRight [], int surfaceWeightPattern [], |
| 57 | int overtFormsHaveSecondaryStress) |
| 58 | { |
| 59 | static const conststring32cxx . . $ conststring32# syllable [] { U"L", U"L1", U"L2", U"H", U"H1", U"H2", U"K", U"K1", U"K2", U"J", U"J1", U"J2" }; |
| 60 | static const conststring32cxx . . $ conststring32# syllableWithoutSecondaryStress [] { U"L", U"L1", U"L", U"H", U"H1", U"H", U"K", U"K1", U"K", U"J", U"J1", U"J" }; |
| 61 | char32cxx . . $ char32# string [150]; |
| 62 | str32cpycxx . . $ str32cpy(6ab934322573b179). (string, underlyingForm); |
| 63 | str32catcxx . . $ str32cat(6ab934322573b179). (string, U" /"); |
| 64 | for (integercxx . . $ integer# isyll = 1; isyll <= numberOfSyllables; isyll ++) { |
| 65 | if (isyll > 1) |
| 66 | str32catcxx . . $ str32cat(6ab934322573b179). (string, U" "); |
| 67 | if (footedToTheRight [isyll] || (! footedToTheLeft [isyll] && stress [isyll] != 0)) |
| 68 | str32catcxx . . $ str32cat(6ab934322573b179). (string, U"("); |
| 69 | str32catcxx . . $ str32cat(6ab934322573b179). (string, syllable [stress [isyll] + 3 * (surfaceWeightPattern [isyll] - 1)]); |
| 70 | if (footedToTheLeft [isyll] || (! footedToTheRight [isyll] && stress [isyll] != 0)) |
| 71 | str32catcxx . . $ str32cat(6ab934322573b179). (string, U")"); |
| 72 | } |
| 73 | str32catcxx . . $ str32cat(6ab934322573b179). (string, U"/ ["); |
| 74 | for (integercxx . . $ integer# isyll = 1; isyll <= numberOfSyllables; isyll ++) { |
| 75 | if (isyll > 1) |
| 76 | str32catcxx . . $ str32cat(6ab934322573b179). (string, U" "); |
| 77 | str32catcxx . . $ str32cat(6ab934322573b179). (string, ( overtFormsHaveSecondaryStress ? syllable : syllableWithoutSecondaryStress ) |
| 78 | [stress [isyll] + 3 * (surfaceWeightPattern [isyll] - 1)]); |
| 79 | } |
| 80 | str32catcxx . . $ str32cat(6ab934322573b179). (string, U"]"); |
| 81 | mycxx . . $ `melder/melder.h:44:9`! candidatescxx . . $ structOTMulti#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).++ mycxx . . $ `melder/melder.h:44:9`! numberOfCandidatescxx . . $ structOTMulti#numberOfCandidates.]. stringcxx . . $ structOTCandidate#string. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (string); |
| 82 | } |
| 83 | |
| 84 | static void fillSurfaceWeightPatterncxx . . $ fillSurfaceWeightPattern(2ec5403eb536df15). (OTMulticxx . . $ OTMulti# me, conststring32cxx . . $ conststring32# underlyingForm, integercxx . . $ integer# numberOfSyllables, int stress [], |
| 85 | bool footedToTheLeft [], bool footedToTheRight [], int underlyingWeightPattern [], |
| 86 | int overtFormsHaveSecondaryStress) |
| 87 | { |
| 88 | int surfaceWeightPattern [1+7], minSurfaceWeight [1+7], maxSurfaceWeight [1+7]; |
| 89 | for (integercxx . . $ integer# isyll = 1; isyll <= numberOfSyllables; isyll ++) { |
| 90 | if (underlyingWeightPattern [isyll] < 3) { |
| 91 | minSurfaceWeight [isyll] = maxSurfaceWeight [isyll] = underlyingWeightPattern [isyll]; // L -> L; H -> H |
| 92 | } else { |
| 93 | minSurfaceWeight [isyll] = 3; |
| 94 | maxSurfaceWeight [isyll] = 4; // C -> { J, K } |
| 95 | } |
| 96 | } |
| 97 | surfaceWeightPattern [6] = surfaceWeightPattern [7] = 1; // constant L |
| 98 | for (int weight1 = minSurfaceWeight [1]; weight1 <= maxSurfaceWeight [1]; weight1 ++) { |
| 99 | surfaceWeightPattern [1] = weight1; |
| 100 | for (int weight2 = minSurfaceWeight [2]; weight2 <= maxSurfaceWeight [2]; weight2 ++) { |
| 101 | surfaceWeightPattern [2] = weight2; |
| 102 | if (numberOfSyllables == 2) { |
| 103 | addCandidatecxx . . $ addCandidate(2ec5403eb536df15). (me, underlyingForm, 2, stress, footedToTheLeft, footedToTheRight, surfaceWeightPattern, overtFormsHaveSecondaryStress); |
| 104 | } else for (int weight3 = minSurfaceWeight [3]; weight3 <= maxSurfaceWeight [3]; weight3 ++) { |
| 105 | surfaceWeightPattern [3] = weight3; |
| 106 | if (numberOfSyllables == 3) { |
| 107 | addCandidatecxx . . $ addCandidate(2ec5403eb536df15). (me, underlyingForm, 3, stress, footedToTheLeft, footedToTheRight, surfaceWeightPattern, overtFormsHaveSecondaryStress); |
| 108 | } else for (int weight4 = minSurfaceWeight [4]; weight4 <= maxSurfaceWeight [4]; weight4 ++) { |
| 109 | surfaceWeightPattern [4] = weight4; |
| 110 | if (numberOfSyllables == 4) { |
| 111 | addCandidatecxx . . $ addCandidate(2ec5403eb536df15). (me, underlyingForm, 4, stress, footedToTheLeft, footedToTheRight, surfaceWeightPattern, overtFormsHaveSecondaryStress); |
| 112 | } else for (int weight5 = minSurfaceWeight [5]; weight5 <= maxSurfaceWeight [5]; weight5 ++) { |
| 113 | surfaceWeightPattern [5] = weight5; |
| 114 | addCandidatecxx . . $ addCandidate(2ec5403eb536df15). (me, underlyingForm, numberOfSyllables, stress, footedToTheLeft, footedToTheRight, surfaceWeightPattern, overtFormsHaveSecondaryStress); |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | static void pathcxx . . $ path(533aa502167ecffb). (OTMulticxx . . $ OTMulti# me, conststring32cxx . . $ conststring32# underlyingForm, integercxx . . $ integer# numberOfSyllables, int stress [], |
| 123 | int startingSyllable, bool footedToTheLeft_in [], bool footedToTheRight_in [], int underlyingWeightPattern [], |
| 124 | int overtFormsHaveSecondaryStress) |
| 125 | { |
| 126 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (startingSyllable < MAXIMUM_NUMBER_OF_SYLLABLES); |
| 127 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (numberOfSyllables < MAXIMUM_NUMBER_OF_SYLLABLES); |
| 128 | |
| 129 | bool footedToTheLeft [MAXIMUM_NUMBER_OF_SYLLABLEScxx . . $ MAXIMUM_NUMBER_OF_SYLLABLES.], footedToTheRight [MAXIMUM_NUMBER_OF_SYLLABLEScxx . . $ MAXIMUM_NUMBER_OF_SYLLABLES.]; |
| 130 | integercxx . . $ integer# isyll; |
| 131 | /* Localize all arguments. */ |
| 132 | for (isyll = 1; isyll <= startingSyllable; isyll ++) { |
| 133 | footedToTheLeft [isyll] = footedToTheLeft_in [isyll]; |
| 134 | footedToTheRight [isyll] = footedToTheRight_in [isyll]; |
| 135 | } |
| 136 | for (isyll = startingSyllable + 1; isyll <= numberOfSyllables; isyll ++) |
| 137 | footedToTheLeft [isyll] = footedToTheRight [isyll] = 0; |
| 138 | if (startingSyllable > numberOfSyllables) { |
| 139 | fillSurfaceWeightPatterncxx . . $ fillSurfaceWeightPattern(2ec5403eb536df15). (me, underlyingForm, numberOfSyllables, stress, footedToTheLeft, footedToTheRight, underlyingWeightPattern, overtFormsHaveSecondaryStress); |
| 140 | } else { |
| 141 | pathcxx . . $ path(533aa502167ecffb). (me, underlyingForm, numberOfSyllables, stress, startingSyllable + 1, |
| 142 | footedToTheLeft, footedToTheRight, underlyingWeightPattern, overtFormsHaveSecondaryStress); |
| 143 | if (stress [startingSyllable] == 0 && startingSyllable < numberOfSyllables && stress [startingSyllable + 1] != 0) { |
| 144 | footedToTheLeft [startingSyllable + 1] = true; |
| 145 | footedToTheRight [startingSyllable] = true; |
| 146 | pathcxx . . $ path(533aa502167ecffb). (me, underlyingForm, numberOfSyllables, stress, startingSyllable + 1, |
| 147 | footedToTheLeft, footedToTheRight, underlyingWeightPattern, overtFormsHaveSecondaryStress); |
| 148 | footedToTheLeft [startingSyllable + 1] = false; |
| 149 | footedToTheRight [startingSyllable] = false; |
| 150 | } |
| 151 | if (stress [startingSyllable] == 0 && startingSyllable > 1 && stress [startingSyllable - 1] != 0 |
| 152 | && ! footedToTheLeft [startingSyllable - 1]) |
| 153 | { |
| 154 | footedToTheRight [startingSyllable - 1] = true; |
| 155 | footedToTheLeft [startingSyllable] = true; |
| 156 | pathcxx . . $ path(533aa502167ecffb). (me, underlyingForm, numberOfSyllables, stress, startingSyllable + 1, |
| 157 | footedToTheLeft, footedToTheRight, underlyingWeightPattern, overtFormsHaveSecondaryStress); |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | static void fillOvertStressPatterncxx . . $ fillOvertStressPattern(6d8d9648cd9b2e3c). (OTMulticxx . . $ OTMulti# me, conststring32cxx . . $ conststring32# underlyingForm, integercxx . . $ integer# numberOfSyllables, int stress [], int underlyingWeightPattern [], |
| 163 | int overtFormsHaveSecondaryStress) |
| 164 | { |
| 165 | bool footedToTheLeft [MAXIMUM_NUMBER_OF_SYLLABLEScxx . . $ MAXIMUM_NUMBER_OF_SYLLABLES.], footedToTheRight [MAXIMUM_NUMBER_OF_SYLLABLEScxx . . $ MAXIMUM_NUMBER_OF_SYLLABLES.]; |
| 166 | for (int isyll = 1; isyll <= numberOfSyllables; isyll ++) |
| 167 | footedToTheLeft [isyll] = footedToTheRight [isyll] = 0; |
| 168 | pathcxx . . $ path(533aa502167ecffb). (me, underlyingForm, numberOfSyllables, stress, 1, footedToTheLeft, footedToTheRight, underlyingWeightPattern, overtFormsHaveSecondaryStress); |
| 169 | } |
| 170 | |
| 171 | static int numberOfCandidates_noCodascxx . . $ numberOfCandidates_noCodas. [1+7] { 0, 1, 6, 24, 88, 300, 984, 3136 }; |
| 172 | static int numberOfCandidates_codascxx . . $ numberOfCandidates_codas. [1+7] { 0, 1, 24, 192, 1408, 9600, 984, 3136 }; |
| 173 | |
| 174 | static void fillTableaucxx . . $ fillTableau(b03f40642bb50946). (OTMulticxx . . $ OTMulti# me, integercxx . . $ integer# numberOfSyllables, int underlyingWeightPattern [], int overtFormsHaveSecondaryStress, int includeCodas) { |
| 175 | char32cxx . . $ char32# underlyingForm [100]; |
| 176 | str32cpycxx . . $ str32cpy(6ab934322573b179). (underlyingForm, U"|"); |
| 177 | for (integercxx . . $ integer# isyll = 1; isyll <= numberOfSyllables; isyll ++) { |
| 178 | static const conststring32cxx . . $ conststring32# syllable_noCodas [] = { U"", U"L", U"H" }; |
| 179 | static const conststring32cxx . . $ conststring32# syllable_codas [] = { U"", U"cv", U"cv:", U"cvc" }; |
| 180 | if (isyll > 1) |
| 181 | str32catcxx . . $ str32cat(6ab934322573b179). (underlyingForm, includeCodas ? U"." : U" "); |
| 182 | str32catcxx . . $ str32cat(6ab934322573b179). (underlyingForm, ( includeCodas ? syllable_codas : syllable_noCodas ) [underlyingWeightPattern [isyll]]); |
| 183 | } |
| 184 | str32catcxx . . $ str32cat(6ab934322573b179). (underlyingForm, U"|"); |
| 185 | for (integercxx . . $ integer# mainStressed = 1; mainStressed <= numberOfSyllables; mainStressed ++) { |
| 186 | int stress [10]; |
| 187 | stress [mainStressed] = 1; |
| 188 | for (int secondary1 = false; secondary1 <= true; secondary1 ++) { |
| 189 | stress [mainStressed <= 1 ? 2 : 1] = secondary1 ? 2 : 0; |
| 190 | if (numberOfSyllables == 2) { |
| 191 | fillOvertStressPatterncxx . . $ fillOvertStressPattern(6d8d9648cd9b2e3c). (me, underlyingForm, 2, stress, underlyingWeightPattern, overtFormsHaveSecondaryStress); |
| 192 | } else for (int secondary2 = false; secondary2 <= true; secondary2 ++) { |
| 193 | stress [mainStressed <= 2 ? 3 : 2] = secondary2 ? 2 : 0; |
| 194 | if (numberOfSyllables == 3) { |
| 195 | fillOvertStressPatterncxx . . $ fillOvertStressPattern(6d8d9648cd9b2e3c). (me, underlyingForm, 3, stress, underlyingWeightPattern, overtFormsHaveSecondaryStress); |
| 196 | } else for (int secondary3 = false; secondary3 <= true; secondary3 ++) { |
| 197 | stress [mainStressed <= 3 ? 4 : 3] = secondary3 ? 2 : 0; |
| 198 | if (numberOfSyllables == 4) { |
| 199 | fillOvertStressPatterncxx . . $ fillOvertStressPattern(6d8d9648cd9b2e3c). (me, underlyingForm, 4, stress, underlyingWeightPattern, overtFormsHaveSecondaryStress); |
| 200 | } else for (int secondary4 = false; secondary4 <= true; secondary4 ++) { |
| 201 | stress [mainStressed <= 4 ? 5 : 4] = secondary4 ? 2 : 0; |
| 202 | if (numberOfSyllables == 5) { |
| 203 | fillOvertStressPatterncxx . . $ fillOvertStressPattern(6d8d9648cd9b2e3c). (me, underlyingForm, 5, stress, underlyingWeightPattern, overtFormsHaveSecondaryStress); |
| 204 | } else for (int secondary5 = false; secondary5 <= true; secondary5 ++) { |
| 205 | stress [mainStressed <= 5 ? 6 : 5] = secondary5 ? 2 : 0; |
| 206 | if (numberOfSyllables == 6) { |
| 207 | fillOvertStressPatterncxx . . $ fillOvertStressPattern(6d8d9648cd9b2e3c). (me, underlyingForm, 6, stress, underlyingWeightPattern, overtFormsHaveSecondaryStress); |
| 208 | } else for (int secondary6 = false; secondary6 <= true; secondary6 ++) { |
| 209 | stress [mainStressed <= 6 ? 7 : 6] = secondary6 ? 2 : 0; |
| 210 | fillOvertStressPatterncxx . . $ fillOvertStressPattern(6d8d9648cd9b2e3c). (me, underlyingForm, 7, stress, underlyingWeightPattern, overtFormsHaveSecondaryStress); |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | static void computeViolationMarkscxx . . $ computeViolationMarks(67a62873e161865c). (OTCandidatecxx . . $ OTCandidate# me) { |
| 221 | #define isHeavycxx . . $ `gram/OTMulti_ex_metrics.cpp:221:10`!(s) ((s) == U'H' || (s) == U'J') |
| 222 | #define isLightcxx . . $ `gram/OTMulti_ex_metrics.cpp:222:10`!(s) ((s) == U'L' || (s) == U'K') |
| 223 | #define isSyllablecxx . . $ `gram/OTMulti_ex_metrics.cpp:223:10`!(s) (isHeavycxx . . $ `gram/OTMulti_ex_metrics.cpp:221:10`! (s) || isLightcxx . . $ `gram/OTMulti_ex_metrics.cpp:222:10`! (s)) |
| 224 | #define isStresscxx . . $ `gram/OTMulti_ex_metrics.cpp:224:10`!(s) ((s) == U'1' || (s) == U'2') |
| 225 | const char32cxx . . $ char32# *const firstSlash = str32chrcxx . . $ str32chr(328a9ede0fba853a). (mycxx . . $ `melder/melder.h:44:9`! stringcxx . . $ structOTCandidate#string..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U'/'); |
| 226 | const char32cxx . . $ char32# *const lastSlash = str32chrcxx . . $ str32chr(328a9ede0fba853a). (firstSlash + 1, U'/'); |
| 227 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). zero_INTVECcxx . . $ zero_INTVEC(dab5d3ef28d6a25). (mycxx . . $ `melder/melder.h:44:9`! numberOfConstraintscxx . . $ structOTCandidate#numberOfConstraints. = NUMBER_OF_CONSTRAINTScxx . . $ `gram/OTMulti_ex_metrics.cpp:47:9`!); |
| 228 | /* Violations of WSP: count all H not followed by 1 or 2. */ |
| 229 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 230 | if (isHeavycxx . . $ `gram/OTMulti_ex_metrics.cpp:221:10`! (p [0]) && ! isStresscxx . . $ `gram/OTMulti_ex_metrics.cpp:224:10`! (p [1])) |
| 231 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).WSPcxx . . $ `gram/OTMulti_ex_metrics.cpp:22:9`!] ++; |
| 232 | } |
| 233 | /* Violations of FtNonfinal: count all heads followed by ). */ |
| 234 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 235 | if (isStresscxx . . $ `gram/OTMulti_ex_metrics.cpp:224:10`! (p [0]) && p [1] == ')') |
| 236 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).FtNonfinalcxx . . $ `gram/OTMulti_ex_metrics.cpp:23:9`!] ++; |
| 237 | } |
| 238 | /* Violations of Iambic: count all heads not followed by ). */ |
| 239 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 240 | if (isStresscxx . . $ `gram/OTMulti_ex_metrics.cpp:224:10`! (p [0]) && p [1] != ')') |
| 241 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).Iambiccxx . . $ `gram/OTMulti_ex_metrics.cpp:24:9`!] ++; |
| 242 | } |
| 243 | /* Violations of Parse and Peripheral: count all syllables not between (). */ |
| 244 | int depth = 0; |
| 245 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 246 | if (p [0] == U'(') depth ++; |
| 247 | else if (p [0] == U')') depth --; |
| 248 | else if (isSyllablecxx . . $ `gram/OTMulti_ex_metrics.cpp:223:10`! (p [0]) && depth != 1) { |
| 249 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).Parsecxx . . $ `gram/OTMulti_ex_metrics.cpp:25:9`!] ++; |
| 250 | if (p != firstSlash + 1 && p != lastSlash - 1) |
| 251 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).Peripheralcxx . . $ `gram/OTMulti_ex_metrics.cpp:38:9`!] ++; |
| 252 | } |
| 253 | } |
| 254 | /* Violations of FootBin: count all (L1) and (L2). */ |
| 255 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 256 | if (isLightcxx . . $ `gram/OTMulti_ex_metrics.cpp:222:10`! (p [0]) && p [-1] == '(' && isStresscxx . . $ `gram/OTMulti_ex_metrics.cpp:224:10`! (p [1]) && p [2] == U')') |
| 257 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).FootBincxx . . $ `gram/OTMulti_ex_metrics.cpp:26:9`!] ++; |
| 258 | } |
| 259 | /* Violations of WFL: count all initial / not followed by (. */ |
| 260 | if (firstSlash [1] != U'(') |
| 261 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).WFLcxx . . $ `gram/OTMulti_ex_metrics.cpp:27:9`!] = 1; |
| 262 | /* Violations of WFR: count all final / not preceded by ). */ |
| 263 | if (lastSlash [-1] != ')') |
| 264 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).WFRcxx . . $ `gram/OTMulti_ex_metrics.cpp:28:9`!] = 1; |
| 265 | /* Violations of Main_L: count syllables from foot containing X1 to left edge. */ |
| 266 | { |
| 267 | const char32cxx . . $ char32# *p = str32chrcxx . . $ str32chr(328a9ede0fba853a). (firstSlash, U'1'); |
| 268 | for (; *p != U'('; p --) { } |
| 269 | for (; p != firstSlash; p --) { |
| 270 | if (isSyllablecxx . . $ `gram/OTMulti_ex_metrics.cpp:223:10`! (p [0])) |
| 271 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).Main_Lcxx . . $ `gram/OTMulti_ex_metrics.cpp:29:9`!] ++; |
| 272 | } |
| 273 | } |
| 274 | /* Violations of Main_R: count syllables from foot containing X1 to right edge. */ |
| 275 | { |
| 276 | const char32cxx . . $ char32# *p = str32chrcxx . . $ str32chr(328a9ede0fba853a). (firstSlash, U'1'); |
| 277 | for (; *p != U')'; p ++) { } |
| 278 | for (; p != lastSlash; p ++) { |
| 279 | if (isSyllablecxx . . $ `gram/OTMulti_ex_metrics.cpp:223:10`! (p [0])) |
| 280 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).Main_Rcxx . . $ `gram/OTMulti_ex_metrics.cpp:30:9`!] ++; |
| 281 | } |
| 282 | } |
| 283 | /* Violations of AFL: count syllables from every foot to left edge. */ |
| 284 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 285 | if (p [0] == U'(') { |
| 286 | for (const char32cxx . . $ char32# *q = p; q != firstSlash; q --) { |
| 287 | if (isSyllablecxx . . $ `gram/OTMulti_ex_metrics.cpp:223:10`! (q [0])) |
| 288 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).AFLcxx . . $ `gram/OTMulti_ex_metrics.cpp:31:9`!] ++; |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | /* Violations of AFR: count syllables from every foot to right edge. */ |
| 293 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 294 | if (p [0] == U')') { |
| 295 | for (const char32cxx . . $ char32# *q = p; q != lastSlash; q ++) { |
| 296 | if (isSyllablecxx . . $ `gram/OTMulti_ex_metrics.cpp:223:10`! (q [0])) |
| 297 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).AFRcxx . . $ `gram/OTMulti_ex_metrics.cpp:32:9`!] ++; |
| 298 | } |
| 299 | } |
| 300 | } |
| 301 | /* Violations of Nonfinal: count all final / preceded by ). */ |
| 302 | if (lastSlash [-1] == U')') |
| 303 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).Nonfinalcxx . . $ `gram/OTMulti_ex_metrics.cpp:33:9`!] = 1; |
| 304 | /* Violations of Trochaic: count all heads not preceded by (. */ |
| 305 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 306 | if (isStresscxx . . $ `gram/OTMulti_ex_metrics.cpp:224:10`! (p [0]) && p [-2] != '(') |
| 307 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).Trochaiccxx . . $ `gram/OTMulti_ex_metrics.cpp:35:9`!] ++; |
| 308 | } |
| 309 | /* Violations of FootBimoraic: count weight between (). */ |
| 310 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 311 | if (p [0] == U'(') { |
| 312 | int weight = 0; |
| 313 | for (p ++; p [0] != ')'; p ++) { |
| 314 | if (isHeavycxx . . $ `gram/OTMulti_ex_metrics.cpp:221:10`! (p [0])) weight += 2; |
| 315 | else if (isLightcxx . . $ `gram/OTMulti_ex_metrics.cpp:222:10`! (p [0])) weight += 1; |
| 316 | } |
| 317 | if (weight != 2) mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).FootBimoraiccxx . . $ `gram/OTMulti_ex_metrics.cpp:36:9`!] ++; |
| 318 | } |
| 319 | } |
| 320 | /* Violations of FootBisyllabic: count all (X1) and (X2). */ |
| 321 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 322 | if (isSyllablecxx . . $ `gram/OTMulti_ex_metrics.cpp:223:10`! (p [0]) && p [-1] == U'(' && isStresscxx . . $ `gram/OTMulti_ex_metrics.cpp:224:10`! (p [1]) && p [2] == U')') |
| 323 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).FootBisyllabiccxx . . $ `gram/OTMulti_ex_metrics.cpp:37:9`!] ++; |
| 324 | } |
| 325 | /* Violations of MainNonfinal: count all final / preceded by ) preceded by 1 in the same foot. */ |
| 326 | if (lastSlash [-1] == U')') { |
| 327 | for (const char32cxx . . $ char32# *p = lastSlash - 2; ; p --) { |
| 328 | if (p [0] == '2') break; |
| 329 | if (p [0] == '1') { |
| 330 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).MainNonfinalcxx . . $ `gram/OTMulti_ex_metrics.cpp:39:9`!] = 1; |
| 331 | break; |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 | /* Violations of HeadNonfinal: count all final / preceded by ) directly preceded by 1, plus MainNonfinal. */ |
| 336 | if (lastSlash [-1] == U')') { |
| 337 | if (lastSlash [-2] == U'1') { |
| 338 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).HeadNonfinalcxx . . $ `gram/OTMulti_ex_metrics.cpp:40:9`!] = 2; |
| 339 | } else { |
| 340 | for (const char32cxx . . $ char32# *p = lastSlash - 2; ; p --) { |
| 341 | if (p [0] == U'2') break; |
| 342 | if (p [0] == U'1') { |
| 343 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).HeadNonfinalcxx . . $ `gram/OTMulti_ex_metrics.cpp:40:9`!] = 1; |
| 344 | break; |
| 345 | } |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | /* Violations of *Clash: count all 1 and 2 followed by an 1 or 2 after the next L or H. */ |
| 350 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 351 | if (isStresscxx . . $ `gram/OTMulti_ex_metrics.cpp:224:10`! (p [0])) { |
| 352 | for (const char32cxx . . $ char32# *q = p + 1; q != lastSlash; q ++) { |
| 353 | if (isSyllablecxx . . $ `gram/OTMulti_ex_metrics.cpp:223:10`! (q [0])) { |
| 354 | if (isStresscxx . . $ `gram/OTMulti_ex_metrics.cpp:224:10`! (q [1])) { |
| 355 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).Clashcxx . . $ `gram/OTMulti_ex_metrics.cpp:41:9`!] ++; |
| 356 | } |
| 357 | break; |
| 358 | } |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | /* Violations of *Lapse: count all sequences of three unstressed syllables. */ |
| 363 | depth = 0; |
| 364 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 365 | if (isSyllablecxx . . $ `gram/OTMulti_ex_metrics.cpp:223:10`! (p [0])) { |
| 366 | if (isStresscxx . . $ `gram/OTMulti_ex_metrics.cpp:224:10`! (p [1])) { |
| 367 | depth = 0; |
| 368 | } else { |
| 369 | if (++ depth > 2) { |
| 370 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).Lapsecxx . . $ `gram/OTMulti_ex_metrics.cpp:42:9`!] ++; |
| 371 | } |
| 372 | } |
| 373 | } |
| 374 | } |
| 375 | /* Violations of WeightByPosition: count all K. */ |
| 376 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 377 | if (p [0] == U'K') |
| 378 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).WeightByPositioncxx . . $ `gram/OTMulti_ex_metrics.cpp:44:9`!] ++; |
| 379 | } |
| 380 | /* Violations of *MoraicConsonant: count all J. */ |
| 381 | for (const char32cxx . . $ char32# *p = firstSlash + 1; p != lastSlash; p ++) { |
| 382 | if (p [0] == U'J') |
| 383 | mycxx . . $ `melder/melder.h:44:9`! markscxx . . $ structOTCandidate#marks. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).MoraicConsonantcxx . . $ `gram/OTMulti_ex_metrics.cpp:45:9`!] ++; |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | static void replaceOutputcxx . . $ replaceOutput(67a62873e161865c). (OTCandidatecxx . . $ OTCandidate# me) { |
| 388 | bool abstract = false; |
| 389 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! string); |
| 390 | char32cxx . . $ char32# newString [150], *q = & newString [0]; |
| 391 | for (const char32cxx . . $ char32# *p = & mycxx . . $ `melder/melder.h:44:9`! stringcxx . . $ structOTCandidate#string. [cxx . . $ _autostring#`operator[]`(b190d49faf30c5be).0]; *p != U'\0'; p ++) { |
| 392 | if (p [0] == U' ') { |
| 393 | *q ++ = p [-1] == U']' || p [1] == U'/' ? U' ' : U'.'; |
| 394 | } else if (isSyllablecxx . . $ `gram/OTMulti_ex_metrics.cpp:223:10`! (p [0])) { |
| 395 | *q ++ = U'c'; |
| 396 | if (abstract) { |
| 397 | *q ++ = U'V'; |
| 398 | if (isStresscxx . . $ `gram/OTMulti_ex_metrics.cpp:224:10`! (p [1])) { |
| 399 | *q ++ = p [1]; |
| 400 | } |
| 401 | if (p [0] == U'L') { |
| 402 | ; |
| 403 | } else if (p [0] == U'H') { |
| 404 | *q ++ = U'V'; |
| 405 | } else if (p [0] == U'K') { |
| 406 | *q ++ = U'c'; |
| 407 | } else { |
| 408 | *q ++ = U'C'; |
| 409 | } |
| 410 | } else { |
| 411 | *q ++ = U'v'; |
| 412 | if (p [0] == U'L') { |
| 413 | ; |
| 414 | } else if (p [0] == 'H') { |
| 415 | *q ++ = U':'; |
| 416 | } else { |
| 417 | *q ++ = U'c'; |
| 418 | } |
| 419 | } |
| 420 | } else if (isStresscxx . . $ `gram/OTMulti_ex_metrics.cpp:224:10`! (p [0]) && abstract) { |
| 421 | ; |
| 422 | } else { |
| 423 | if (p [0] == U'/') abstract = true; |
| 424 | *q ++ = p [0]; |
| 425 | } |
| 426 | } |
| 427 | *q = U'\0'; |
| 428 | mycxx . . $ `melder/melder.h:44:9`! stringcxx . . $ structOTCandidate#string. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (newString); |
| 429 | } |
| 430 | |
| 431 | autoOTMulticxx . . $ autoOTMulti# OTMulti_create_metricscxx . . $ OTMulti_create_metrics(958e3198317757e). ( |
| 432 | kOTGrammar_createMetricsGrammar_initialRankingcxx . . $ kOTGrammar_createMetricsGrammar_initialRanking# equal_footForm_wsp, |
| 433 | int trochaicityConstraint, int includeFootBimoraic, int includeFootBisyllabic, |
| 434 | int includePeripheral, int nonfinalityConstraint, int overtFormsHaveSecondaryStress, |
| 435 | int includeClashAndLapse, int includeCodas) |
| 436 | { |
| 437 | try { |
| 438 | int underlyingWeightPattern [1+7], maximumUnderlyingWeight = includeCodas ? 3 : 2; |
| 439 | autoOTMulticxx . . $ autoOTMulti# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (OTMulti); |
| 440 | mycxx . . $ `melder/melder.h:44:9`! constraintscxx . . $ structOTMulti#constraints. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). newvectorzerocxx . . $ newvectorzero(d6d5973469733409). <structOTConstraintcxx . . $ structOTConstraint#> (mycxx . . $ `melder/melder.h:44:9`! numberOfConstraintscxx . . $ structOTMulti#numberOfConstraints. = NUMBER_OF_CONSTRAINTScxx . . $ `gram/OTMulti_ex_metrics.cpp:47:9`!); |
| 441 | for (integercxx . . $ integer# icons = 1; icons <= NUMBER_OF_CONSTRAINTScxx . . $ `gram/OTMulti_ex_metrics.cpp:47:9`!; icons ++) { |
| 442 | const OTConstraintcxx . . $ OTConstraint# constraint = & mycxx . . $ `melder/melder.h:44:9`! constraintscxx . . $ structOTMulti#constraints. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).icons]; |
| 443 | constraint -> namecxx . . $ structOTConstraint#name. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (constraintNamescxx . . $ constraintNames. [icons]); |
| 444 | constraint -> rankingcxx . . $ structOTConstraint#ranking. = 100.0; |
| 445 | constraint -> plasticitycxx . . $ structOTConstraint#plasticity. = 1.0; |
| 446 | } |
| 447 | if (equal_footForm_wsp >= kOTGrammar_createMetricsGrammar_initialRankingcxx . . $ kOTGrammar_createMetricsGrammar_initialRanking#::FOOT_FORM_HIGHcxx . . $ kOTGrammar_createMetricsGrammar_initialRanking#FOOT_FORM_HIGH.) { |
| 448 | /* |
| 449 | Foot form constraints high. |
| 450 | */ |
| 451 | mycxx . . $ `melder/melder.h:44:9`! constraintscxx . . $ structOTMulti#constraints. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).FtNonfinalcxx . . $ `gram/OTMulti_ex_metrics.cpp:23:9`!]. rankingcxx . . $ structOTConstraint#ranking. = 101.0; |
| 452 | mycxx . . $ `melder/melder.h:44:9`! constraintscxx . . $ structOTMulti#constraints. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).Iambiccxx . . $ `gram/OTMulti_ex_metrics.cpp:24:9`!]. rankingcxx . . $ structOTConstraint#ranking. = 101.0; |
| 453 | mycxx . . $ `melder/melder.h:44:9`! constraintscxx . . $ structOTMulti#constraints. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).Trochaiccxx . . $ `gram/OTMulti_ex_metrics.cpp:35:9`!]. rankingcxx . . $ structOTConstraint#ranking. = -1e9; |
| 454 | } |
| 455 | if (equal_footForm_wsp == kOTGrammar_createMetricsGrammar_initialRankingcxx . . $ kOTGrammar_createMetricsGrammar_initialRanking#::WSP_HIGHcxx . . $ kOTGrammar_createMetricsGrammar_initialRanking#WSP_HIGH.) { |
| 456 | /* |
| 457 | Quantity sensitivity high, foot form constraints in the second stratum. |
| 458 | */ |
| 459 | mycxx . . $ `melder/melder.h:44:9`! constraintscxx . . $ structOTMulti#constraints. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).WSPcxx . . $ `gram/OTMulti_ex_metrics.cpp:22:9`!]. rankingcxx . . $ structOTConstraint#ranking. = 102.0; |
| 460 | } |
| 461 | integercxx . . $ integer# numberOfCandidates = 0; |
| 462 | for (int numberOfSyllables = 2; numberOfSyllables <= 7; numberOfSyllables ++) { |
| 463 | const integercxx . . $ integer# numberOfUnderlyingWeightPatterns = ( numberOfSyllables > 5 ? 1 : Melder_iroundcxx . . $ `melder/melder_ftoi.h:78:9`! (powcxx . . $ pow(9454dda30a4b8335). (maximumUnderlyingWeight, numberOfSyllables)) ); |
| 464 | numberOfCandidates += ( includeCodas ? numberOfCandidates_codascxx . . $ numberOfCandidates_codas. : numberOfCandidates_noCodascxx . . $ numberOfCandidates_noCodas. ) [numberOfSyllables] * numberOfUnderlyingWeightPatterns; |
| 465 | } |
| 466 | mycxx . . $ `melder/melder.h:44:9`! candidatescxx . . $ structOTMulti#candidates. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). newvectorzerocxx . . $ newvectorzero(d6d5973469733409). <structOTCandidatecxx . . $ structOTCandidate#> (numberOfCandidates); |
| 467 | mycxx . . $ `melder/melder.h:44:9`! numberOfCandidatescxx . . $ structOTMulti#numberOfCandidates. = 0; |
| 468 | for (int numberOfSyllables = 2; numberOfSyllables <= 7; numberOfSyllables ++) { |
| 469 | const integercxx . . $ integer# numberOfUnderlyingWeightPatterns = ( numberOfSyllables > 5 ? 1 : Melder_iroundcxx . . $ `melder/melder_ftoi.h:78:9`! (powcxx . . $ pow(9454dda30a4b8335). (maximumUnderlyingWeight, numberOfSyllables)) ); |
| 470 | for (integercxx . . $ integer# isyll = 1; isyll <= numberOfSyllables; isyll ++) |
| 471 | underlyingWeightPattern [isyll] = 1; // L or cv |
| 472 | for (integercxx . . $ integer# iweightPattern = 1; iweightPattern <= numberOfUnderlyingWeightPatterns; iweightPattern ++) { |
| 473 | fillTableaucxx . . $ fillTableau(b03f40642bb50946). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), numberOfSyllables, underlyingWeightPattern, overtFormsHaveSecondaryStress, includeCodas); |
| 474 | /* |
| 475 | Cycle to next underlying weight pattern. |
| 476 | */ |
| 477 | underlyingWeightPattern [numberOfSyllables] += 1; |
| 478 | for (integercxx . . $ integer# isyll = numberOfSyllables; isyll >= 2; isyll --) { |
| 479 | if (underlyingWeightPattern [isyll] > maximumUnderlyingWeight) { |
| 480 | underlyingWeightPattern [isyll] = 1; |
| 481 | underlyingWeightPattern [isyll - 1] += 1; |
| 482 | } |
| 483 | } |
| 484 | } |
| 485 | } |
| 486 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! numberOfCandidates == numberOfCandidates); |
| 487 | for (integercxx . . $ integer# icand = 1; icand <= mycxx . . $ `melder/melder.h:44:9`! numberOfCandidatescxx . . $ structOTMulti#numberOfCandidates.; icand ++) |
| 488 | computeViolationMarkscxx . . $ computeViolationMarks(67a62873e161865c). (& mycxx . . $ `melder/melder.h:44:9`! candidatescxx . . $ structOTMulti#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).icand]); |
| 489 | OTMulti_checkIndexcxx . . $ OTMulti_checkIndex(a34eed4b1c1d1bc5). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 490 | OTMulti_newDisharmoniescxx . . $ OTMulti_newDisharmonies(8663bcc155b161db). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.0); |
| 491 | if (trochaicityConstraint == 1) |
| 492 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"Trochaic"); |
| 493 | else |
| 494 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"FtNonfinal"); |
| 495 | if (! includeFootBimoraic) |
| 496 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"FtBimor"); |
| 497 | if (! includeFootBisyllabic) |
| 498 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"FtBisyl"); |
| 499 | if (! includePeripheral) |
| 500 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"Peripheral"); |
| 501 | if (nonfinalityConstraint == 1) { |
| 502 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"MainNonfinal"); |
| 503 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"HeadNonfinal"); |
| 504 | } else if (nonfinalityConstraint == 2) { |
| 505 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"HeadNonfinal"); |
| 506 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"Nonfinal"); |
| 507 | } else { |
| 508 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"MainNonfinal"); |
| 509 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"Nonfinal"); |
| 510 | } |
| 511 | if (! includeClashAndLapse) { |
| 512 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"*Clash"); |
| 513 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"*Lapse"); |
| 514 | } |
| 515 | if (! includeCodas) { |
| 516 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"WeightByPosition"); |
| 517 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"*C\\mu"); |
| 518 | } |
| 519 | if (includeCodas) { |
| 520 | for (integercxx . . $ integer# icand = 1; icand <= mycxx . . $ `melder/melder.h:44:9`! numberOfCandidatescxx . . $ structOTMulti#numberOfCandidates.; icand ++) { |
| 521 | replaceOutputcxx . . $ replaceOutput(67a62873e161865c). (& mycxx . . $ `melder/melder.h:44:9`! candidatescxx . . $ structOTMulti#candidates. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).icand]); |
| 522 | } |
| 523 | } |
| 524 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 525 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 526 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Metrics grammar not created."); |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | /* End of file OTMulti_ex_metrics.cpp */ |