HowManyAreAnalyzed(): use status_user_agent to report progress
[linguistica.git] / DCNlearning.h
blob48afa2633b8e9d02e7625e17fa721b4529ba879c
1 // Driver for stress discovery with Dynamic Computational Networks
2 // Copyright © 2009 The University of Chicago
3 #ifndef LEARNING_H
4 #define LEARNING_H
6 // See http://linguistica.uchicago.edu/dcnstress.htm for history and
7 // documentation.
9 #include "DCNgrammar.h"
11 namespace linguistica { namespace ui { class status_user_agent; } }
12 typedef class QString* corpusType;
14 /**
15 * The learning class uses a simplified version of Gary Larson's
16 * simulated annealing process to find an appropriate grammar
17 * given a corpus of various words with stress. The name is kind
18 * of weird -- it's easiest to think of an instance as a learning
19 * machine. It takes a corpus (an array of QStrings) and returns
20 * a possible grammar. It's also not very well implemented --
21 * nearly everything is public.
23 * The most interesting function is
24 * runHelper(), which is the essence of the learning algorithm.
25 * It is a first attempt at the learning algorithm, so at the
26 * moment it's kind of crappy. Luckily, the GUI supports
27 * inputting different values for the learning algorithm.
29 class learning
32 public:
33 learning();
34 virtual ~learning();
35 void run(linguistica::ui::status_user_agent& status_display);
36 bool isSuccessful() { return successful; }
37 void setCorpus(corpusType corpus, int numberOfWords);
38 grammar* returnGrammar();
40 float TfromUser;
41 float increaseWhenWrong;
42 float decreaseWhenRight;
43 int numberOfTries;
44 unsigned int cutoffFromUser;
46 float startingAlpha;
47 float startingBeta;
48 float startingI;
49 float startingF;
51 private:
52 void runHelper(class Q3TextStream& logstream,
53 linguistica::ui::status_user_agent& status_display);
54 bool successful;
55 corpusType corpus;
56 int numberOfWords;
57 grammar theGrammar;
58 grammar possibleGrammar;
59 int maxSyl;
62 #endif // LEARNING_H