HowManyAreAnalyzed(): use status_user_agent to report progress
[linguistica.git] / MonteCarlo.h
blob4c1b0a53349a8cb3b981d5b19b82ee16d2b8be18
1 // Random string generator following a model of phonology
2 // Copyright © 2009 The University of Chicago
3 #ifndef MONTECARLO_H
4 #define MONTECARLO_H
6 class MonteCarlo;
8 #include <vector>
9 #include <QStringList>
10 #include <QString>
11 #include <Q3Dict>
12 #include "Parse.h"
13 #include "generaldefinitions.h"
15 // This is a class that keeps track of unigram and bigram frequencies, and is
16 // able to produce strings on the basis of those distributions.
17 // The top level MonteCarlo keeps track of phone frequencies, and is
18 // capable of setting up one MonteCarlo for *each* of its phones, so
19 // that it can produce strings based on bigram frequencies.
20 // If we want that fancier kind, then the m_ModelType should be BIGRAM;
21 // otherwise, it should be UNIGRAM.
23 class MonteCarlo
25 QStringList m_Keys;
26 std::vector<double> m_Values;
27 int m_Size;
28 bool m_ReadyForAction;
30 Q3Dict<MonteCarlo> m_MyBigrams;
31 QString m_MyFirstPhone;
33 public:
35 eModelType m_ModelType;
38 MonteCarlo(int size);
39 MonteCarlo(int size, QString MyFirstPhone );
41 void Dump ( Q3TextStream* );
42 void SetSize(int size) { m_Size = size; };
43 int GetSize() { return m_Size;};
44 Q3Dict<MonteCarlo>* GetMyBigrams() { return &m_MyBigrams; }
45 void StockDictionary ( QString key, double value, int i) { m_Keys.append (key);
46 m_Values [i] = value; }
48 void Normalize ();
51 QString ReturnCharacter ( );
52 QString ReturnCharacter ( QString PrecedingChar );
53 CParse ReturnString ( CParse& );
56 #endif // MONTECARLO_H