Class: TextAlignment::LCSComparison
- Inherits:
-
Object
- Object
- TextAlignment::LCSComparison
- Defined in:
- lib/text_alignment/lcs_comparison.rb
Instance Attribute Summary collapse
-
#similarity ⇒ Object
readonly
The similarity ratio of the given two strings after stripping unmatched prefixes and suffixes.
-
#str1_match_final ⇒ Object
readonly
The initial and final matching positions of str1 and str2.
-
#str1_match_initial ⇒ Object
readonly
The initial and final matching positions of str1 and str2.
-
#str2_match_final ⇒ Object
readonly
The initial and final matching positions of str1 and str2.
-
#str2_match_initial ⇒ Object
readonly
The initial and final matching positions of str1 and str2.
Instance Method Summary collapse
-
#initialize(str1, str2, lcs = nil, sdiff = nil) ⇒ LCSComparison
constructor
A new instance of LCSComparison.
Constructor Details
#initialize(str1, str2, lcs = nil, sdiff = nil) ⇒ LCSComparison
Returns a new instance of LCSComparison.
13 14 15 16 17 |
# File 'lib/text_alignment/lcs_comparison.rb', line 13 def initialize(str1, str2, lcs = nil, sdiff = nil) raise ArgumentError, "nil string" if str1 == nil || str2 == nil @str1, @str2 = str1, str2 _lcs_comparison(str1, str2, lcs, sdiff) end |
Instance Attribute Details
#similarity ⇒ Object (readonly)
The similarity ratio of the given two strings after stripping unmatched prefixes and suffixes
8 9 10 |
# File 'lib/text_alignment/lcs_comparison.rb', line 8 def similarity @similarity end |
#str1_match_final ⇒ Object (readonly)
The initial and final matching positions of str1 and str2
11 12 13 |
# File 'lib/text_alignment/lcs_comparison.rb', line 11 def str1_match_final @str1_match_final end |
#str1_match_initial ⇒ Object (readonly)
The initial and final matching positions of str1 and str2
11 12 13 |
# File 'lib/text_alignment/lcs_comparison.rb', line 11 def str1_match_initial @str1_match_initial end |
#str2_match_final ⇒ Object (readonly)
The initial and final matching positions of str1 and str2
11 12 13 |
# File 'lib/text_alignment/lcs_comparison.rb', line 11 def str2_match_final @str2_match_final end |
#str2_match_initial ⇒ Object (readonly)
The initial and final matching positions of str1 and str2
11 12 13 |
# File 'lib/text_alignment/lcs_comparison.rb', line 11 def str2_match_initial @str2_match_initial end |