CMiniLexicon::FindMajorSignatures(): use log file routines
[linguistica.git] / BiphoneCollection.h
blobb2e3ea7e209844870736ca66e6407bf01f313480
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;
8 #include <Q3Dict>
9 #include "Biphone.h"
11 #include <Q3SortedList>
12 #include <QString>
13 #include "Parse.h"
14 #include "generaldefinitions.h"
16 class CBiphoneCollection : public Q3Dict<CBiphone> {
17 public:
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;
25 int* m_Count;
26 double* m_LogFreqs;
27 double* m_Freqs;
28 int m_Length; ///< size of alphabet
29 double* m_MI;
30 double m_SumOfMyMIs;
31 int m_TotalCount;
32 double m_Z_biphones;
33 public:
34 // construction/destruction.
36 CBiphoneCollection(class CWordCollection*);
37 CBiphoneCollection(class CPhoneCollection*);
38 virtual ~CBiphoneCollection();
40 // disable default-construction, copy
41 private:
42 CBiphoneCollection();
43 CBiphoneCollection(const CBiphoneCollection& x);
44 CBiphoneCollection& operator=(const CBiphoneCollection& x);
45 public:
46 // assign.
48 void Empty();
50 // find.
52 CBiphone* operator^=(CParse& str);
53 CBiphone* operator^=(QString str);
54 CBiphone* GetBiphone(class CPhone* lhs, class CPhone* rhs);
56 // insert.
58 CBiphone* Insert(class CPhone* lhs, class CPhone* rhs);
60 // sort.
62 void Sort();
64 // size.
66 void SetSize(int i);
68 // counts.
70 void SetAtLogFreq(int FirstPhoneIndex, int SecondPhoneIndex,
71 double val);
72 double GetLogFreq(int FirstPhoneIndex, int SecondPhoneIndex);
73 void IncrementAtCount (int FirstPhoneIndex, int SecondPhoneIndex,
74 int incr = 1);
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();
84 double ComputeZ_MI();
86 /// output to GUI
87 void ListDisplay(Q3ListView* widget);
90 #endif // BIPHONECOLLECTION_H