1 // alignment result from string-edit distance algorithm
2 // Copyright © 2009 The University of Chicago
8 /// an alignment of two strings, Str1 and Str2.
9 /// There's an array for each string, Match1 and Match2, and they
10 /// explain how that letter lines up with its counterpart on the opposite
11 /// string. "-1" means there is no match. A non-negative number is the
12 /// index of the character to which it's aligned or matched on the
16 // These are parses, so that we can cut them into
17 // pieces, based on where the alignments change qualitatively
18 // (where the slips begin or end).
23 int* m_Match1
; // "-1" means no match
26 // number of times the alignment departs from
27 // 1-to-1 alignment. Two or more non-alignments counts as 1 slip.
29 // How many continuous regions of good or bad associations there are.
33 // construction/destruction.
35 CAlignment(class QString String1
, class QString String2
);
36 CAlignment(CParse
*, CParse
*);
38 CAlignment(const CAlignment
*);
39 virtual ~CAlignment();
43 CAlignment(const CAlignment
& other
);
44 CAlignment
& operator=(const CAlignment
& other
);
46 double FindStringEditDistance();
47 CParse
CalculateDisplay();
49 CParse
FindSubstitution();
52 void SetScore(float s
) { m_Score
= s
; }
54 // true if the char is aligned and identical to its matchee
55 bool String1CharMatches(int);
56 bool String2CharMatches(int);
57 // true if these two chars are identical and aligned
58 bool PerfectMatch(int n
, int m
);
60 // which piece corresponds to piece n, if any (otherwise, 0)
61 // corresponding pieces need not be identical stringwise
62 int Str2MatchForStr1Piece(int n
);
63 // which piece corresponds to piece n, if any (else 0);
64 // corresponding pieces need not be identical stringwise
65 int Str1MatchForStr2Piece(int n
);