HowManyAreAnalyzed(): use status_user_agent to report progress
[linguistica.git] / cMT.h
blob906f48f8fdcf927918009598fad3af8b2abf65b3
1 // Machine Translation driver
2 // Copyright © 2009 The University of Chicago
3 #ifndef CMT_H
4 #define CMT_H
6 #include <QString>
8 class LinguisticaMainWindow;
9 class mTVolca;
10 class cMTModel1;
11 class cMTModel2Norm;
12 class mTForSortingItem;
14 template<class V> class Q3SortedList;
15 template<class K, class V> class QMap;
17 typedef Q3SortedList<mTForSortingItem> mTSortedList;
18 typedef QMap<int, double> IntToDouble;
19 typedef QMap<int, IntToDouble*> IntToIntToDouble;
21 class cMT {
22 public:
23 LinguisticaMainWindow* m_parent;
24 QString m_projectDirectory;
26 mTVolca* m_Volca;
28 /// Model 1
29 cMTModel1* m_Model1;
30 /// Model 2
31 cMTModel2Norm* m_Model2Norm;
33 /// Log parameter
34 QString m_MTLog;
35 public:
36 // construction/destruction.
38 cMT(LinguisticaMainWindow*, QString);
39 virtual ~cMT();
41 // disable default-construction, copy
42 private:
43 cMT();
44 cMT(const cMT& x);
45 cMT& operator=(const cMT& x);
46 public:
47 // training.
49 void readTrainingCorpus();
50 /// Model 1
51 void trainModel1(int);
52 /// Model 2
53 void trainModel2Norm(int, bool);
55 // output to logs.
57 /// Log Model1
58 void logTAfterModel1();
59 /// Log Model2
60 void logTandAAfterModel2Norm();
63 class mTForSortingItem {
64 public:
65 QString m_name;
66 int m_type;
67 double m_doubleValue;
68 public:
69 // construction/destruction.
71 mTForSortingItem() : m_name(), m_type(0), m_doubleValue(0.0) { }
72 mTForSortingItem(QString name, double value, int type)
73 : m_name(name), m_type(type),
74 m_doubleValue(m_type == 1 ? value : 0.0) { }
75 // destructor implicitly defined
77 // copy construction/assignment implicitly defined
79 // compare.
81 bool operator<(const mTForSortingItem& x)
83 return m_type == 1 ?
84 m_doubleValue > x.m_doubleValue :
85 true;
87 bool operator==(const mTForSortingItem& x)
89 return m_type == 1 ?
90 m_doubleValue == x.m_doubleValue :
91 true;
95 #endif // CMT_H