1 // Implementation of CStem description length methods
2 // Copyright © 2009 The University of Chicago
4 #include "MiniLexicon.h"
6 #include "StemCollection.h"
9 double CStem::GetLengthOfPointerToMe() const
11 if (m_LengthOfPointerToMe
> 0)
12 return m_LengthOfPointerToMe
;
13 m_LengthOfPointerToMe
= log2(m_pMyMini
->GetStems()->GetCorpusCount() /
15 return m_LengthOfPointerToMe
;
18 double CStem::GetLengthOfPointerToMe_2()
19 { return GetLengthOfPointerToMe(); }
21 double CStem::GetPhonologicalInformationContent(CLexicon
* MotherLexicon
) const
23 if (m_PhonologicalContent
!= 0.0)
24 return m_PhonologicalContent
;
26 if (MotherLexicon
!= 0)
27 CalculatePhonologicalInformationContent(MotherLexicon
);
28 return m_PhonologicalContent
;
31 double CStem::CalculatePhonologicalInformationContent(CLexicon
* Lexicon
) const
33 m_PhonologicalContent
= m_BigramLogProb
> 0.0 ?
35 CParse::ComputeDL(Lexicon
->GetNumberOfCharacterTypes());
36 return m_PhonologicalContent
;
39 // Calculate the description length
42 // float - the descrition length
43 float CStem::CalculateDL() const
45 static const float PointerLength
= log2(float(27.0));
46 return PointerLength
* GetKeyLength();