Debian Codegraph @

gram/OTGrammar.h

raw symbols SCIP
1 #cxx . . $ `<file>/gram/OTGrammar.h`/ifndef _OTGrammar_h_
2 #define _OTGrammar_h_cxx . . $ `gram/OTGrammar.h:2:9`!
3 /* OTGrammar.h
4 *
5 * Copyright (C) 1997-2012,2014-2018,2021,2025 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 "Strings_.h"cxx . . $ `<file>/sys/Strings_.h`/
22 #include "Graphics.h"cxx . . $ `<file>/sys/Graphics.h`/
23 #include "PairDistribution.h"cxx . . $ `<file>/stat/PairDistribution.h`/
24 #include "Distributions.h"cxx . . $ `<file>/stat/Distributions.h`/
25 #include "TableOfReal.h"cxx . . $ `<file>/stat/TableOfReal.h`/
26
27 #include "OTGrammar_enums.h"cxx . . $ `<file>/gram/OTGrammar_enums.h`/
28
29 #include "OTGrammar_def.h"cxx . . $ `<file>/gram/OTGrammar_def.h`/
30
31 Thing_definecxx . . $ theClassInfo_OTHistory. (OTHistory, TableOfReal) {
32 };
33
34 void OTGrammar_sortcxx . . $ OTGrammar_sort(17bef8f582790df). (OTGrammarcxx . . $ OTGrammar# me);
35 /* Low level: meant to maintain the invariant
36 * my constraints [my index [i]]. disharmony >= my constraints [my index [i+1]]. disharmony
37 * Therefore, call after every direct assignment to the 'disharmony' attribute.
38 * Tied constraints are sorted alphabetically.
39 */
40
41 void OTGrammar_newDisharmoniescxx . . $ OTGrammar_newDisharmonies(ebbb2d2a494dd028). (OTGrammarcxx . . $ OTGrammar# me, double spreading);
42
43 integercxx . . $ integer# OTGrammar_getTableaucxx . . $ OTGrammar_getTableau(c62a8df3d6387e3f). (constOTGrammarcxx . . $ constOTGrammar# me, conststring32cxx . . $ conststring32# input);
44 int OTGrammar_compareCandidatescxx . . $ OTGrammar_compareCandidates(75a0bd0abef82b32). (OTGrammarcxx . . $ OTGrammar# me, integercxx . . $ integer# itab1, integercxx . . $ integer# icand1, integercxx . . $ integer# itab2, integercxx . . $ integer# icand2);
45 /*
46 * Function:
47 * to compare the optimality of candidates icand1 in tableau itab1
48 * and icand2 in tableau itab2.
49 * Return value:
50 * -1 if candidate icand1 is more optimal than candidate icand2;
51 * +1 if candidate icand2 is more optimal than candidate icand1;
52 * 0 if both candidates are equally optimal.
53 * Algorithm:
54 * the current disharmony ranking is considered.
55 * Takes into account crucial ties: if multiple constraints are ranked at
56 * exactly the same height (disharmony), they count as a single constraint.
57 * This is original OT. To get Anttila's and GLA's variationist interpretation
58 * of ties instead (even in EDCD), make sure you introduce a bit of noise
59 * (e.g. 1e-6 if the strata are 1.0 apart). That makes
60 * the probability of ties almost zero.
61 */
62
63 /* Productive parsing. */
64 integercxx . . $ integer# OTGrammar_getWinnercxx . . $ OTGrammar_getWinner(7a18ede9c0367db4). (OTGrammarcxx . . $ OTGrammar# me, integercxx . . $ integer# itab);
65 /* Gives randomized results in case of tied candidates. */
66 integercxx . . $ integer# OTGrammar_getNumberOfOptimalCandidatescxx . . $ OTGrammar_getNumberOfOptimalCandidates(7a18ede9c0367db4). (OTGrammarcxx . . $ OTGrammar# me, integercxx . . $ integer# itab);
67 bool OTGrammar_isCandidateGrammaticalcxx . . $ OTGrammar_isCandidateGrammatical(f38c237485a6e739). (OTGrammarcxx . . $ OTGrammar# me, integercxx . . $ integer# itab, integercxx . . $ integer# icand);
68 bool OTGrammar_isCandidateSinglyGrammaticalcxx . . $ OTGrammar_isCandidateSinglyGrammatical(f38c237485a6e739). (OTGrammarcxx . . $ OTGrammar# me, integercxx . . $ integer# itab, integercxx . . $ integer# icand);
69
70 /* Interpretive parsing. */
71 void OTGrammar_getInterpretiveParsecxx . . $ OTGrammar_getInterpretiveParse(c29944d43509464b).
72 (OTGrammarcxx . . $ OTGrammar# me, conststring32cxx . . $ conststring32# partialOutput, integercxx . . $ integer# *bestTableau, integercxx . . $ integer# *bestCandidate);
73 /* Gives randomized results in case of tied candidates. */
74 bool OTGrammar_isPartialOutputGrammaticalcxx . . $ OTGrammar_isPartialOutputGrammatical(f10314946276fdfa). (OTGrammarcxx . . $ OTGrammar# me, conststring32cxx . . $ conststring32# partialOutput);
75 /* Is there an input for which this partial output is contained in any of the optimal outputs? */
76 bool OTGrammar_isPartialOutputSinglyGrammaticalcxx . . $ OTGrammar_isPartialOutputSinglyGrammatical(f10314946276fdfa). (OTGrammarcxx . . $ OTGrammar# me, conststring32cxx . . $ conststring32# partialOutput);
77 /* Is every optimal output that contains this partial output the only optimal output in its tableau? */
78 bool OTGrammar_areAllPartialOutputsGrammaticalcxx . . $ OTGrammar_areAllPartialOutputsGrammatical(78c251f47636c607). (OTGrammarcxx . . $ OTGrammar# me, Stringscxx . . $ Strings# thee);
79 bool OTGrammar_areAllPartialOutputsSinglyGrammaticalcxx . . $ OTGrammar_areAllPartialOutputsSinglyGrammatical(78c251f47636c607). (OTGrammarcxx . . $ OTGrammar# me, Stringscxx . . $ Strings# thee);
80
81 void OTGrammar_drawTableaucxx . . $ OTGrammar_drawTableau(822cef9b7e8eee15). (OTGrammarcxx . . $ OTGrammar# me, Graphicscxx . . $ Graphics# g, bool vertical, conststring32cxx . . $ conststring32# input);
82
83 autoStringscxx . . $ autoStrings# OTGrammar_generateInputscxx . . $ OTGrammar_generateInputs(2c631e0145e471da). (OTGrammarcxx . . $ OTGrammar# me, integercxx . . $ integer# numberOfTrials);
84 autoStringscxx . . $ autoStrings# OTGrammar_getInputscxx . . $ OTGrammar_getInputs(d533707318a2ea1b). (OTGrammarcxx . . $ OTGrammar# me);
85 autostring32cxx . . $ autostring32# OTGrammar_inputToOutputcxx . . $ OTGrammar_inputToOutput(c8f670774824696c). (OTGrammarcxx . . $ OTGrammar# me, conststring32cxx . . $ conststring32# input, double evaluationNoise);
86 autoStringscxx . . $ autoStrings# OTGrammar_inputsToOutputscxx . . $ OTGrammar_inputsToOutputs(14edd5c2a0df16ec). (OTGrammarcxx . . $ OTGrammar# me, Stringscxx . . $ Strings# inputs, double evaluationNoise);
87 autoStringscxx . . $ autoStrings# OTGrammar_inputToOutputscxx . . $ OTGrammar_inputToOutputs(d25e0ea609ea9bc8). (OTGrammarcxx . . $ OTGrammar# me, conststring32cxx . . $ conststring32# input, integercxx . . $ integer# n, double evaluationNoise);
88 autoDistributionscxx . . $ autoDistributions# OTGrammar_to_Distributioncxx . . $ OTGrammar_to_Distribution(e63311810804d1e0). (OTGrammarcxx . . $ OTGrammar# me, integercxx . . $ integer# trialsPerInput, double evaluationNoise);
89 autoPairDistributioncxx . . $ autoPairDistribution# OTGrammar_to_PairDistributioncxx . . $ OTGrammar_to_PairDistribution(816b1fe75c724a5c). (OTGrammarcxx . . $ OTGrammar# me, integercxx . . $ integer# trialsPerInput, double evaluationNoise);
90 autoDistributionscxx . . $ autoDistributions# OTGrammar_measureTypology_WEAKcxx . . $ OTGrammar_measureTypology_WEAK(e4ba9d8bf50fd03e). (OTGrammarcxx . . $ OTGrammar# me); // WEAK because it has a progress bar
91
92 void OTGrammar_learnOnecxx . . $ OTGrammar_learnOne(ee39fc6cd929bcff). (OTGrammarcxx . . $ OTGrammar# me, conststring32cxx . . $ conststring32# input, conststring32cxx . . $ conststring32# adultOutput,
93 double rankingSpreading, enum kOTGrammar_rerankingStrategycxx . . $ kOTGrammar_rerankingStrategy# updateRule, bool honourLocalRankings,
94 double demotionMean, double relativeDemotionSpreading, bool newDisharmonies,
95 bool warnIfStalled, bool *grammarHasChanged);
96 void OTGrammar_learncxx . . $ OTGrammar_learn(3827da1cf6d683c8). (OTGrammarcxx . . $ OTGrammar# me, Stringscxx . . $ Strings# inputs, Stringscxx . . $ Strings# outputs,
97 double rankingSpreading, enum kOTGrammar_rerankingStrategycxx . . $ kOTGrammar_rerankingStrategy# updateRule, bool honourLocalRankings,
98 double demotionMean, double relativeDemotionSpreading, integercxx . . $ integer# numberOfChews);
99 void OTGrammar_PairDistribution_learncxx . . $ OTGrammar_PairDistribution_learn(a19079481669c00d). (OTGrammarcxx . . $ OTGrammar# me, PairDistributioncxx . . $ PairDistribution# thee,
100 double evaluationNoise, enum kOTGrammar_rerankingStrategycxx . . $ kOTGrammar_rerankingStrategy# updateRule, bool honourLocalRankings,
101 double initialPlasticity, integercxx . . $ integer# replicationsPerPlasticity, double plasticityDecrement,
102 integercxx . . $ integer# numberOfPlasticities, double relativePlasticityNoise, integercxx . . $ integer# numberOfChews);
103 bool OTGrammar_PairDistribution_findPositiveWeightscxx . . $ OTGrammar_PairDistribution_findPositiveWeights(eaf0cef6ddde00a8). (OTGrammarcxx . . $ OTGrammar# me, PairDistributioncxx . . $ PairDistribution# thee, double weightFloor, double marginOfSeparation);
104 void OTGrammar_learnOneFromPartialOutputcxx . . $ OTGrammar_learnOneFromPartialOutput(bf78488c347ea88b). (OTGrammarcxx . . $ OTGrammar# me, conststring32cxx . . $ conststring32# partialAdultOutput,
105 double rankingSpreading, enum kOTGrammar_rerankingStrategycxx . . $ kOTGrammar_rerankingStrategy# updateRule, bool honourLocalRankings,
106 double demotionMean, double relativeDemotionSpreading, integercxx . . $ integer# numberOfChews, bool warnIfStalled);
107 void OTGrammar_learnFromPartialOutputscxx . . $ OTGrammar_learnFromPartialOutputs(d1f13382b8c2ea65). (OTGrammarcxx . . $ OTGrammar# me, Stringscxx . . $ Strings# partialOutputs,
108 double rankingSpreading, enum kOTGrammar_rerankingStrategycxx . . $ kOTGrammar_rerankingStrategy# updateRule, bool honourLocalRankings,
109 double demotionMean, double relativeDemotionSpreading, integercxx . . $ integer# numberOfChews, integercxx . . $ integer# storeHistoryEvery, autoOTHistorycxx . . $ autoOTHistory# *history);
110 void OTGrammar_Distributions_learnFromPartialOutputscxx . . $ OTGrammar_Distributions_learnFromPartialOutputs(6fee105ba7335590). (OTGrammarcxx . . $ OTGrammar# me, Distributionscxx . . $ Distributions# thee, integercxx . . $ integer# columnNumber,
111 double evaluationNoise, enum kOTGrammar_rerankingStrategycxx . . $ kOTGrammar_rerankingStrategy# updateRule, bool honourLocalRankings,
112 double initialPlasticity, integercxx . . $ integer# replicationsPerPlasticity, double plasticityDecrement,
113 integercxx . . $ integer# numberOfPlasticities, double relativePlasticityNoise, integercxx . . $ integer# numberOfChews,
114 integercxx . . $ integer# storeHistoryEvery, autoOTHistorycxx . . $ autoOTHistory# *history_out,
115 bool resampleForVirtualProduction, bool compareOnlyPartialOutput, integercxx . . $ integer# resampleForCorrectForm);
116 double OTGrammar_PairDistribution_getFractionCorrectcxx . . $ OTGrammar_PairDistribution_getFractionCorrect(94bcbbbc39507653). (OTGrammarcxx . . $ OTGrammar# me, PairDistributioncxx . . $ PairDistribution# thee,
117 double evaluationNoise, integercxx . . $ integer# numberOfInputs);
118 integercxx . . $ integer# OTGrammar_PairDistribution_getMinimumNumberCorrectcxx . . $ OTGrammar_PairDistribution_getMinimumNumberCorrect(682fb95bb304ac5f). (OTGrammarcxx . . $ OTGrammar# me, PairDistributioncxx . . $ PairDistribution# thee,
119 double evaluationNoise, integercxx . . $ integer# numberOfReplications);
120 double OTGrammar_Distributions_getFractionCorrectcxx . . $ OTGrammar_Distributions_getFractionCorrect(6cc4c2aef93c6d6c). (OTGrammarcxx . . $ OTGrammar# me, Distributionscxx . . $ Distributions# thee, integercxx . . $ integer# columnNumber,
121 double evaluationNoise, integercxx . . $ integer# numberOfInputs);
122
123 void OTGrammar_checkIndexcxx . . $ OTGrammar_checkIndex(17bef8f582790df). (OTGrammarcxx . . $ OTGrammar# me);
124
125 autoOTGrammarcxx . . $ autoOTGrammar# OTGrammar_create_NoCoda_grammarcxx . . $ OTGrammar_create_NoCoda_grammar(7ca07e509e4e6648). ();
126 autoOTGrammarcxx . . $ autoOTGrammar# OTGrammar_create_NPA_grammarcxx . . $ OTGrammar_create_NPA_grammar(7ca07e509e4e6648). ();
127 autoPairDistributioncxx . . $ autoPairDistribution# OTGrammar_create_NPA_distributioncxx . . $ OTGrammar_create_NPA_distribution(55fbb411edc59193). ();
128 autoOTGrammarcxx . . $ autoOTGrammar# OTGrammar_create_tongueRoot_grammarcxx . . $ OTGrammar_create_tongueRoot_grammar(dd2490af35a81629). (
129 kOTGrammar_createTongueRootGrammar_constraintSetcxx . . $ kOTGrammar_createTongueRootGrammar_constraintSet# small_large,
130 kOTGrammar_createTongueRootGrammar_rankingcxx . . $ kOTGrammar_createTongueRootGrammar_ranking# equal_random_infant_Wolof
131 );
132 autoOTGrammarcxx . . $ autoOTGrammar# OTGrammar_create_metricscxx . . $ OTGrammar_create_metrics(16e8b8c6d2dce2df). (
133 kOTGrammar_createMetricsGrammar_initialRankingcxx . . $ kOTGrammar_createMetricsGrammar_initialRanking# equal_footForm_wsp,
134 int trochaicityConstraint, bool includeFootBimoraic, bool includeFootBisyllabic,
135 bool includePeripheral, int nonfinalityConstraint, bool overtFormsHaveSecondaryStress, bool includeClashAndLapse, bool includeCodas);
136 /* T&S: 1, false, false, false, 1, true, false, false */
137
138 void OTGrammar_resetcxx . . $ OTGrammar_reset(ebbb2d2a494dd028). (OTGrammarcxx . . $ OTGrammar# me, double ranking);
139 void OTGrammar_resetToRandomRankingcxx . . $ OTGrammar_resetToRandomRanking(b654a70d7ca48ec1). (OTGrammarcxx . . $ OTGrammar# me, double mean, double standardDeviation);
140 void OTGrammar_resetToRandomTotalRankingcxx . . $ OTGrammar_resetToRandomTotalRanking(b654a70d7ca48ec1). (OTGrammarcxx . . $ OTGrammar# me, double maximumRanking, double rankingDistance);
141 void OTGrammar_setRankingcxx . . $ OTGrammar_setRanking(68a1fc1b7054b6a3). (OTGrammarcxx . . $ OTGrammar# me, integercxx . . $ integer# constraint, double ranking, double disharmony);
142 void OTGrammar_setConstraintPlasticitycxx . . $ OTGrammar_setConstraintPlasticity(73ee87a426f39261). (OTGrammarcxx . . $ OTGrammar# me, integercxx . . $ integer# constraint, double plasticity);
143
144 void OTGrammar_removeConstraintcxx . . $ OTGrammar_removeConstraint(90425b6eb4fa5279). (OTGrammarcxx . . $ OTGrammar# me, conststring32cxx . . $ conststring32# constraintName);
145 void OTGrammar_removeHarmonicallyBoundedCandidatescxx . . $ OTGrammar_removeHarmonicallyBoundedCandidates(de1cdd9e0b276ab2). (OTGrammarcxx . . $ OTGrammar# me, bool singly);
146 bool OTGrammar_areAllOutputsDistinguishablecxx . . $ OTGrammar_areAllOutputsDistinguishable(62951cbe4b2b5c08). (OTGrammarcxx . . $ OTGrammar# me);
147 autoTablecxx . . $ autoTable# OTGrammar_tabulateEquivalentPairscxx . . $ OTGrammar_tabulateEquivalentPairs(1b61c83392fc114d). (OTGrammarcxx . . $ OTGrammar# me);
148 void OTGrammar_PairDistribution_listObligatoryRankingscxx . . $ OTGrammar_PairDistribution_listObligatoryRankings(df4b34804257e4d4). (OTGrammarcxx . . $ OTGrammar# me, PairDistributioncxx . . $ PairDistribution# thee);
149 void OTGrammar_Distributions_listObligatoryRankingscxx . . $ OTGrammar_Distributions_listObligatoryRankings(53d5c23304eec8aa). (OTGrammarcxx . . $ OTGrammar# me, Distributionscxx . . $ Distributions# thee, integercxx . . $ integer# columnNumber);
150 autoTablecxx . . $ autoTable# OTGrammar_tabulateAllCorrectRankingscxx . . $ OTGrammar_tabulateAllCorrectRankings(c1a5b99a0b12b6a8). (constOTGrammarcxx . . $ constOTGrammar# me, constStringscxx . . $ constStrings# inputs, constStringscxx . . $ constStrings# partialOutputs);
151
152 void OTGrammar_writeToHeaderlessSpreadsheetFilecxx . . $ OTGrammar_writeToHeaderlessSpreadsheetFile(b477585282d679e0). (OTGrammarcxx . . $ OTGrammar# me, MelderFilecxx . . $ MelderFile# file);
153
154 /* End of file OTGrammar.h */
155 #endif