CMiniLexicon::FindMajorSignatures(): clean up whitespace
[linguistica.git] / DCNlearningsyl.h
blob9abcc5dd1db1329a6a492a5af709b18207724314
1 // Driver state type for syllable discovery with Dynamic Computational Networks
2 // Copyright © 2009 The University of Chicago
3 #ifndef LEARNINGSYL_H
4 #define LEARNINGSYL_H
6 // See the corpussyl documentation in DCNcorpussyl.h for an overview.
8 #include <ostream>
9 #include "DCNgrammarsyl.h"
10 #include "DCNnetworksyl.h"
11 #include "DCNcorpussyl.h"
13 namespace linguistica { namespace ui { class status_user_agent; } }
15 /**
16 * The learning class uses a simplified version of Gary Larson's
17 * simulated annealing process to find an appropriate grammar
18 * given a corpus of various words with stress. The name is kind
19 * of weird -- it's easiest to think of an instance as a learning
20 * machine. It takes a corpus (an array of QStrings) and returns
21 * a possible grammar. It's also not very well implemented --
22 * nearly everything is public.
24 * The most interesting function is
25 * runHelper(), which is the essence of the learning algorithm.
26 * It is a first attempt at the learning algorithm, so at the
27 * moment it's kind of crappy. Luckily, the GUI supports
28 * inputting different values for the learning algorithm.
30 class learningsyl
32 bool successful;
33 corpussyl corpus;
34 unsigned int numberOfWords;
36 grammarsyl grammar;
37 networksyl net;
38 grammarsyl possibleGrammar;
39 networksyl possibleNet;
40 grammarsyl* rGrammar;
41 public:
42 float TfromUser;
43 float increaseWhenWrong;
44 float decreaseWhenRight;
45 int numberOfTries;
46 unsigned int cutoffFromUser;
48 float startingAlpha;
49 float startingBeta;
50 public:
51 learningsyl();
52 virtual ~learningsyl();
54 void run(linguistica::ui::status_user_agent& status_display);
55 bool isSuccessful() { return successful; }
56 void setCorpus(corpussyl corpus);
57 void print(class QLabel* label) { net.print(label); }
58 grammarsyl* returnGrammar() { return rGrammar; }
60 private:
61 void runHelper(std::ostream& logstream,
62 linguistica::ui::status_user_agent& status_display);
65 #endif // LEARNINGSYL_H