2 // Copyright © 2009 The University of Chicago
7 #include "CorpusCount.h"
11 /// A subclass of CParse adapted for use in Linguistica.
13 A subclass of CParse with some additional, Linguistica specific members and methods.
16 class CLParse
: public CParse
, public linguistica::corpus_count
{
19 //--------------------------------------------------
20 // Protected member variables
21 //--------------------------------------------------
23 bool m_DoNotParse
; ///< true if this CLParse should not be further parsed
24 bool m_DoomFlag
; ///< true if this CLParse is to be destroyed
25 int m_Index
; ///< this CLParse's position in parent collection
26 int m_SortIndex
; ///< this CLParse's sorted position in parent collection
27 CParse
* m_Trigrams
; ///< list of trigrams in this CLParse
28 QString m_AlphabetizedForm
; ///< string with all characters of this CLParse alphabetized
29 CMiniLexicon
* m_pMyMini
; ///< this CLParse's grandparent mini-lexicon
35 //--------------------------------------------------
36 // Constructors/Destructor
37 //--------------------------------------------------
39 CLParse( CMiniLexicon
* );
40 CLParse( const QChar
&, CMiniLexicon
* );
41 CLParse( const CParse
*, CMiniLexicon
* );
42 CLParse( const CStringSurrogate
&, CMiniLexicon
* );
43 CLParse( const CLParse
& x
);
44 CLParse( const CParse
&, CMiniLexicon
* );
48 CLParse
& operator=(const CLParse
& other
);
51 //--------------------------------------------------
52 // Public accessor methods
53 //--------------------------------------------------
55 int CompareTrigrams(CLParse
&);
56 QString
GetAlphabetizedForm() const { return m_AlphabetizedForm
; }
57 int GetIndex() const { return m_Index
; }
58 CMiniLexicon
* GetMyMini() const { return m_pMyMini
; }
59 int GetSortIndex() const { return m_SortIndex
; }
60 virtual float GetSortingQuantity() const { return 0.0; } // TODO: Ask John
61 virtual QString
GetSortingString() { return ""; } // TODO: Ask John
62 bool IsDoomed() const { return m_DoomFlag
; }
63 bool MayBeParsed() const { return !m_DoNotParse
; }
66 //--------------------------------------------------
67 // Public mutator methods
68 //--------------------------------------------------
70 void CalculateTrigrams();
71 void DoNotParse(bool b
= true) { m_DoNotParse
= b
; }
72 void Doomed(bool b
= true) { m_DoomFlag
= b
; }
73 CParse
* GetTrigrams();
74 void PrepareWordForInput(bool, QString
);
75 void SetAlphabetizedForm(QString s
) { m_AlphabetizedForm
= s
; }
76 void SetIndex (int n
) { m_Index
= n
; }
77 void SetMyMini( CMiniLexicon
* mini
) { m_pMyMini
= mini
; }
78 void SetSortIndex(int n
) { m_SortIndex
= n
; }
79 void SetTriGramsToNULL() { m_Trigrams
= NULL
; }
82 virtual void SetLengthOfPieceVector( int i
) { m_LengthOfPieceVector
= i
; };