1 // Menu for forming a word in string alignment-based model of morphology
2 // Copyright © 2009 The University of Chicago
14 template<class K
, class V
> class QMap
;
15 typedef QMap
<QString
, class CParse
*> StringToParse
;
16 typedef QMap
<QString
, float> StringToFloat
;
17 typedef QMap
<QString
, StringToFloat
*> StringToStringToFloat
;
19 /// this is a class for schemas -- a sequence of slots. Each column is a CParse.
20 class CTemplate
: public CStem
22 friend class CTemplateListViewItem
;
23 friend class LinguisticaMainWindow
;
24 friend class CTemplateCollection
;
25 int m_NumberOfColumns
;
27 mutable float m_WordsTotalComplexity
; // total complexity of words without any analysis
28 mutable float m_Complexity
;
29 //int m_SortingComplexity;
35 mutable float m_CurrentSortComplexity
;
36 mutable float m_NewSortComplexity
;
38 bool m_IsNewAfterCollapse1
;
39 int m_StemColumnInCollapse1
;
40 //WordsAndInt m_AbsordedWords;
41 //TemplateAndWordsAndInt m_AbsordedWordsFromEachTemplate;
42 bool m_SwitchOfSortingValue
;
48 CTemplate (int NumberOfColumns
);
49 CTemplate ( CAlignment
* );
50 CTemplate ( CTemplate
&);
53 int GetNumberOfColumns () { return m_NumberOfColumns
; }
54 float ComputeWordsTotalComplexity() const;
55 float GetWordsTotalComplexity();
56 float GetComplexity() ;
57 float ComputeComplexity() const;
58 int GetMaximumColumnHeight();
59 void operator= (CAlignment
* );
61 //void Display ( CListCtrl& , int& LineNumber);
63 QString
DisplayFirstLine();
64 int GetVerticalColumn();
65 void AddToColumn(CParse
&, int n
);
66 void AddToColumn ( CStringSurrogate
&, int n
);
68 float GetSortingQuantity() const;
69 double GetTemplateSortingQuantity();
70 CParse
* GetColumn(int n
);
71 void GetWordsAndParses(StringToParse
& OneWordAndParse
);
72 QString
GetEntry (int row
, int column
);
73 void AddAlignment( CAlignment
*);
74 int GetNumberOfLetters();
76 bool ShouldConflate ( CTemplate
*, int& conflatecolumn
);
77 void ConflateWith ( CTemplate
* pOther
, int Column
);
78 bool Readjust(class CTemplateCollection
* , int MinCount
= 2); // checks to see if letters should be moved from one column to the other
79 void ListDisplay(Q3ListView
* list
);
81 void AdjustMeByMovingCommonTailOrHead2(StringToFloat
& , int , int , bool PrintChangedTemplates
,\
82 int , bool , StringToStringToFloat
& , \
86 void SetSwitchOfSortingValue(bool value
){m_SwitchOfSortingValue
= value
;};
87 void AdjustMeAfterAbsorb1(StringToInt
& , bool , int , int);
88 void GetWordsFromTwoColums(StringToInt
& , int );
89 void FindMorphemePrefixOrSuffixWithParadigmaticGraph(int, int , StringToFloat
& , StringToStringToFloat
& , float , float );
90 float GetRobustNessWithParadigmaticGraph(CParse
& , StringToFloat
& , StringToStringToFloat
& , float , float );
93 //void OutputForFile (ofstream& );
94 //eAffixationType DetermineAffixationSide ();
95 //void AddToCollections ( eAffixationType ThisType,
96 // CStemCollection* Stems,
97 // CAffixCollection* Affixes,
98 // CSignatureCollection* Signatures
104 class CTemplateListViewItem
: public Q3ListViewItem
{
106 CTemplate
* m_Template
;
107 int m_MaxMumShownMorphemes
;
109 CTemplateListViewItem(Q3ListView
* parent
= 0,
110 CTemplate
* templ
= 0, QString label
= QString());
111 CTemplateListViewItem(Q3ListViewItem
* parent
,
112 CTemplate
* templ
, QString label
);
114 virtual QString
text(int) const;
115 virtual QString
key(int, bool) const;
117 CTemplate
* GetTemplate() { return m_Template
; }