HowManyAreAnalyzed(): use status_user_agent to report progress
[linguistica.git] / Morpheme.h
blob1032957d12eac7ff639d7535f662f498e1e94d9a
1 // CMorpheme, CMorphemeListViewItem classes
2 // Copyright © 2009 The University of Chicago
3 #ifndef MORPHEME_H
4 #define MORPHEME_H
6 #include "LParse.h"
7 #include "SparseVector.h"
8 #include <q3listview.h>
10 class CMorpheme;
12 class MorphemeCount
14 CMorpheme* Morpheme;
15 double Frequency;
19 class CMorphemeListViewItem : public Q3ListViewItem {
20 CMorpheme* m_morpheme;
21 public:
22 explicit CMorphemeListViewItem(Q3ListView* parent = 0,
23 QString text = QString(), CMorpheme* morphene = 0);
25 // copy.
27 CMorphemeListViewItem(const CMorphemeListViewItem& x)
28 : Q3ListViewItem(x), m_morpheme(x.m_morpheme) { }
29 CMorphemeListViewItem& operator=(const CMorphemeListViewItem& x)
31 Q3ListViewItem::operator=(x);
32 m_morpheme = x.m_morpheme;
33 return *this;
36 // Qt3 list view item interface.
38 virtual QString text(int column_index) const;
39 virtual QString key(int column, bool ascending) const;
42 class CMorpheme : public CLParse
45 CParse m_SuffixList;
46 CParse m_PrefixList;
47 double m_ILogProb;
48 double m_DLSavings;
49 double m_DLImprovementFromSuffixes; // this keeps track of how much improvement in Description Length
50 double m_Frequency;
51 double m_MorphemeCount;
53 public: // fix that
54 int m_SF;
55 int m_PF;
58 public:
59 CSparseVector m_PrecedingMorphemes;
60 CSparseVector m_FollowingMorphemes;
65 // arises from the suffixes that this morpheme makes possible.
66 public:
67 CMorpheme( CMiniLexicon* mini = NULL );
68 CMorpheme(CMorpheme* );
69 CMorpheme (CStringSurrogate, CMiniLexicon* mini = NULL );
70 ~CMorpheme();
71 void AddSuffix ( CStringSurrogate );
72 void AddSuffixes ( CMorphemeCollection* );
73 void CopySuffixList ( CMorpheme* );
74 CParse* GetSuffixList ( );
76 void AddPrefix ( CStringSurrogate );
77 CParse* GetPrefixList ( );
81 void ListDisplay ( Q3ListView* );
82 void SetDLSavings ( double);
83 double GetDLSavings ( );
85 double GetILogProb ( );
86 void SetILogProb (double);
88 void SetDLImprovementFromSuffixes ( double );
89 double GetDLImprovementFromSuffixes ( );
91 double GetFrequency ( );
92 void SetFrequency ( double );
94 void SetMorphemeCount ( double ) ;
95 double GetMorphemeCount ( );
96 void IncrementMorphemeCount ( double );
98 float GetSortingQuantity() const;
99 int GetPF () const { return m_PF; }
100 int GetSF () const { return m_SF; }
104 #endif // MORPHEME_H