CMiniLexicon::FindMajorSignatures(): use log file routines
[linguistica.git] / Biphone.h
blob948bb900d4dbbc6c8af183bc4ac637e6c2fa4a9b
1 // Description length bookkeeping and display for a phoneme pair
2 // Copyright © 2009 The University of Chicago
3 #ifndef BIPHONE_H
4 #define BIPHONE_H
6 class CBiphone;
7 class CBiphoneListViewItem;
9 #include <Q3ListViewItem>
10 #include "LParse.h"
12 #include <QString>
13 #include "generaldefinitions.h"
15 class CBiphoneListViewItem : public Q3ListViewItem {
16 CBiphone* m_MyBiphone;
17 public:
18 explicit CBiphoneListViewItem(Q3ListView* parent = 0,
19 QString bigram_text = QString(), CBiphone* bigram = 0);
20 explicit CBiphoneListViewItem(Q3ListViewItem* parent,
21 QString bigram_text = QString(), CBiphone* bigram = 0);
23 // copy.
25 CBiphoneListViewItem(const CBiphoneListViewItem& x)
26 : Q3ListViewItem(x), m_MyBiphone(x.m_MyBiphone) { }
27 CBiphoneListViewItem& operator=(const CBiphoneListViewItem& x)
29 Q3ListViewItem::operator=(x);
30 m_MyBiphone = x.m_MyBiphone;
31 return *this;
34 // Qt3 list view item interface.
36 virtual QString text(int column_index) const;
37 int compare(Q3ListViewItem* other, int column, bool ascending) const;
39 // underlying biphone object.
41 CBiphone* GetBiphone() const { return m_MyBiphone; }
42 void SetBiphone(CBiphone* pBiphone) { m_MyBiphone = pBiphone; }
45 class CBiphone : public CLParse {
46 public:
47 static enum eBiphoneSortStyle m_SortStyle;
48 public:
49 QString m_Key;
50 double m_Freq;
51 double m_LogFreq;
52 double m_MI;
53 double m_WMI;
54 double m_LogCondProb;
55 double m_CondProb;
56 double m_NormalizedMI;
57 class CPhone* m_MyFirst;
58 class CPhone* m_MySecond;
59 public:
60 // construction/destruction.
62 CBiphone();
63 CBiphone(QString unigrams);
64 virtual ~CBiphone();
66 // copy.
68 CBiphone(const CBiphone& x);
69 CBiphone& operator=(const CBiphone&);
71 // compare.
73 bool operator==(const CBiphone& x);
74 bool operator<(const CBiphone& x);
76 // counts.
78 void SetMI (double value);
79 double GetMI() { return m_MI; }
80 void SetLogFreq(double d) { m_LogFreq = d; }
82 /// output to GUI
83 void BiphoneListDisplay(Q3ListView* widget);
86 #endif // BIPHONE_H