Class: TextAlignment::LCSComparison

Inherits:
Object
  • Object
show all
Defined in:
lib/text_alignment/lcs_comparison.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str1, str2, lcs = nil, sdiff = nil) ⇒ LCSComparison

Returns a new instance of LCSComparison.

Raises:

  • (ArgumentError)


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

#similarityObject (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_finalObject (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_initialObject (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_finalObject (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_initialObject (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