1 // Driver and result type for alignment of similar signatures
2 // Copyright © 2009 The University of Chicago
10 enum eAlignmentStatus
{IDENTICAL
, DIFFERENT
};
12 class AffixAlignment
{
13 QString m_OriginalAffix1
;
14 QString m_OriginalAffix2
;
21 enum eAlignmentStatus m_Status
;
22 /// size in bits of overlap of letters/phonemes
23 double m_Agreement_unigram
;
24 /// size in bits of overlap of bigram-letters/phonemes
25 double m_Agreement_bigram
;
26 /// size in bits of symmetric difference.
27 double m_Disagreement_unigram
;
28 double m_Disagreement_bigram
;
30 // construction/destruction.
32 AffixAlignment(QString Affix1
, QString Affix2
);
33 AffixAlignment(QString Margin1
, QString Affix1
,
34 QString Margin2
, QString Affix2
);
35 // destructor implicitly defined.
37 // copy-construction and assignment implicitly defined.
39 // disable default-construction
44 QString
GetAffix1() const { return m_Affix1
;}
45 QString
GetAffix2() const { return m_Affix2
;}
46 QString
GetMargin1() const { return m_Margin1
;}
47 QString
GetMargin2() const { return m_Margin2
;}
48 QString
GetShift1() const { return m_Shift1
;}
49 QString
GetShift2() const { return m_Shift2
;}
52 /// m_Sig1 is shorter than m_Sig2, or of same length.
53 class SignatureAlignment
{
54 class CSignature
* m_SigPtr1
;
55 class CSignature
* m_SigPtr2
;
56 QList
<AffixAlignment
*> m_AffixAlignments
;
59 CParse m_Sig1AlignedAffixes
;
60 CParse m_Sig2AlignedAffixes
;
62 // construction/destruction.
64 SignatureAlignment(class CSignature
* Sig1
, class CSignature
* Sig2
);
65 // destructor implicitly defined
67 // disable default-construction, copy
70 SignatureAlignment(const SignatureAlignment
& x
);
71 SignatureAlignment
& operator=(const SignatureAlignment
& x
);
74 // Levenshtein’s string-edit-distance algorithm
76 void FindBestAlignment();
78 bool AllSig1AffixesAligned();
79 bool AllSig2AffixesAligned();
80 /// result from string-edit-distance algorithm
81 QList
<AffixAlignment
*>* GetAffixAlignments()
82 { return &m_AffixAlignments
; }
85 void Display(QTextStream
& LogStream
);
88 #endif // ALLOMORPHY_H