1 // Description length bookkeeping, search, and display of encountered biphones
2 // Copyright © 2009 The University of Chicago
3 #ifndef BIPHONECOLLECTION_H
4 #define BIPHONECOLLECTION_H
6 class CBiphoneCollection
;
11 #include <Q3SortedList>
14 #include "generaldefinitions.h"
16 class CBiphoneCollection
: public Q3Dict
<CBiphone
> {
18 Q3SortedList
<CBiphone
> m_PtrArray
;
19 Q3SortedList
<CBiphone
> m_CountSortArray
;
20 Q3SortedList
<CBiphone
> m_MISortArray
;
21 Q3SortedList
<CBiphone
> m_WMISortArray
;
22 enum eBiphoneSortStyle m_SortStyle
;
23 class CPhoneCollection
* m_Phones
;
24 class CWordCollection
* m_MyWords
;
28 int m_Length
; ///< size of alphabet
34 // construction/destruction.
36 CBiphoneCollection(class CWordCollection
*);
37 CBiphoneCollection(class CPhoneCollection
*);
38 virtual ~CBiphoneCollection();
40 // disable default-construction, copy
43 CBiphoneCollection(const CBiphoneCollection
& x
);
44 CBiphoneCollection
& operator=(const CBiphoneCollection
& x
);
52 CBiphone
* operator^=(CParse
& str
);
53 CBiphone
* operator^=(QString str
);
54 CBiphone
* GetBiphone(class CPhone
* lhs
, class CPhone
* rhs
);
58 CBiphone
* Insert(class CPhone
* lhs
, class CPhone
* rhs
);
70 void SetAtLogFreq(int FirstPhoneIndex
, int SecondPhoneIndex
,
72 double GetLogFreq(int FirstPhoneIndex
, int SecondPhoneIndex
);
73 void IncrementAtCount (int FirstPhoneIndex
, int SecondPhoneIndex
,
75 void SetAtCount(int FirstPhoneIndex
, int SecondPhoneIndex
, int n
);
76 int GetCount(int FirstPhoneIndex
, int SecondPhoneIndex
);
77 int GetTotalCount() { return m_TotalCount
; }
79 // mutual information.
81 void SetAtMI(int FirstPhoneIndex
, int SecondPhoneIndex
, double val
);
82 double GetMI(CBiphone
* bigram
);
83 double GetSumOfMyMIs();
87 void ListDisplay(Q3ListView
* widget
);
90 #endif // BIPHONECOLLECTION_H