1 #ifndef _OTMulti_h_ 2 #define _OTMulti_h_ 3 /* OTMulti.h 4 * 5 * Copyright (C) 2005-2009,2011,2012,2014-2018 Paul Boersma 6 * 7 * This code is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or (at 10 * your option) any later version. 11 * 12 * This code is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 * See the GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this work. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #include "Graphics.h" 22 #include "PairDistribution.h" 23 #include "Distributions.h" 24 #include "OTGrammar.h" 25 26 #include "OTMulti_def.h" 27 28 integer OTMulti_getConstraintIndexFromName (OTMulti me, conststring32 name); 29 30 void OTMulti_checkIndex (OTMulti me); 31 32 void OTMulti_sort (OTMulti me); 33 /* Low level: meant to maintain the invariant 34 * my constraints [my index [i]]. disharmony >= my constraints [my index [i+1]]. disharmony 35 * Therefore, call after every direct assignment to the 'disharmony' attribute. 36 * Tied constraints should not exist. 37 */ 38 39 void OTMulti_newDisharmonies (OTMulti me, double evaluationNoise); 40 41 int OTMulti_candidateMatches (OTMulti me, integer icand, conststring32 form1, conststring32 form2); 42 int OTMulti_compareCandidates (OTMulti me, integer icand1, integer icand2); 43 integer OTMulti_getWinner (OTMulti me, conststring32 form1, conststring32 form2); 44 45 #define OTMulti_LEARN_FORWARD 1 46 #define OTMulti_LEARN_BACKWARD 2 47 #define OTMulti_LEARN_BIDIRECTIONALLY 3 48 int OTMulti_learnOne (OTMulti me, conststring32 form1, conststring32 form2, 49 enum kOTGrammar_rerankingStrategy updateRule, int direction, double plasticity, double relativePlasticityNoise); 50 void OTMulti_PairDistribution_learn (OTMulti me, PairDistribution thee, 51 double evaluationNoise, enum kOTGrammar_rerankingStrategy updateRule, int direction, 52 double initialPlasticity, integer replicationsPerPlasticity, double plasticityDecrement, 53 integer numberOfPlasticities, double relativePlasticityNoise, integer storeHistoryEvery, autoTable *history_out); 54 55 void OTMulti_drawTableau (OTMulti me, Graphics g, conststring32 form1, conststring32 form2, bool vertical, bool showDisharmonies); 56 57 autoOTMulti OTMulti_create_metrics ( 58 kOTGrammar_createMetricsGrammar_initialRanking equal_footForm_wsp, 59 int trochaicityConstraint, int includeFootBimoraic, int includeFootBisyllabic, 60 int includePeripheral, int nonfinalityConstraint, int overtFormsHaveSecondaryStress, 61 int includeClashAndLapse, int includeCodas); 62 63 void OTMulti_reset (OTMulti me, double ranking); 64 void OTMulti_setRanking (OTMulti me, integer constraint, double ranking, double disharmony); 65 void OTMulti_setConstraintPlasticity (OTMulti me, integer constraint, double plasticity); 66 void OTMulti_removeConstraint (OTMulti me, conststring32 constraintName); 67 68 autostring32 OTMulti_generateOptimalForm (OTMulti me, conststring32 form1, conststring32 form2, double evaluationNoise); 69 autoStrings OTMulti_generateOptimalForms (OTMulti me, conststring32 form1, conststring32 form2, integer numberOfTrials, double evaluationNoise); 70 autoDistributions OTMulti_to_Distribution (OTMulti me, conststring32 form1, conststring32 form2, integer numberOfTrials, double evaluationNoise); 71 autoStrings OTMulti_Strings_generateOptimalForms (OTMulti me, Strings forms, double evaluationNoise); 72 73 /* End of file OTMulti.h */ 74 #endif 75