CMiniLexicon::FindMajorSignatures(): use log file routines
[linguistica.git] / Template.h
blob758d4fc300a2720a68e3ca0cc6625fa63ba4133c
1 // Menu for forming a word in string alignment-based model of morphology
2 // Copyright © 2009 The University of Chicago
3 #ifndef TEMPLATE_H
4 #define TEMPLATE_H
6 #include <QString>
8 #include "Stem.h"
9 #include "Typedefs.h"
11 class CAlignment;
12 enum eAffixationType;
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;
26 CParse** m_Columns;
27 mutable float m_WordsTotalComplexity; // total complexity of words without any analysis
28 mutable float m_Complexity;
29 //int m_SortingComplexity;
30 int m_TemplateNumber;
32 // Delete flag
33 bool m_IsDeleted;
35 mutable float m_CurrentSortComplexity;
36 mutable float m_NewSortComplexity;
37 int m_ModifiedColumn;
38 bool m_IsNewAfterCollapse1;
39 int m_StemColumnInCollapse1;
40 //WordsAndInt m_AbsordedWords;
41 //TemplateAndWordsAndInt m_AbsordedWordsFromEachTemplate;
42 bool m_SwitchOfSortingValue;
47 public:
48 CTemplate (int NumberOfColumns);
49 CTemplate ( CAlignment* );
50 CTemplate ( CTemplate&);
51 ~CTemplate(void);
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);
62 QString Display();
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& , \
83 float , float );
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
99 // );
104 class CTemplateListViewItem : public Q3ListViewItem {
105 protected:
106 CTemplate* m_Template;
107 int m_MaxMumShownMorphemes;
108 public:
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; }
120 #endif // TEMPLATE_H