Class: FuzzyWuzzy

Inherits:
Object
  • Object
show all
Defined in:
lib/match-mate/utils/fuzzy_wuzzy.rb

Instance Method Summary collapse

Constructor Details

#initialize(value, other_value) ⇒ FuzzyWuzzy

Returns a new instance of FuzzyWuzzy.



4
5
6
7
8
# File 'lib/match-mate/utils/fuzzy_wuzzy.rb', line 4

def initialize(value, other_value)
  @values = [value].flatten.map(&:to_s)
  @other_values = [other_value].flatten.map(&:to_s)
  PyCall.exec import
end

Instance Method Details

#partial_ratioObject

Compares partial string similarity



21
22
23
# File 'lib/match-mate/utils/fuzzy_wuzzy.rb', line 21

def partial_ratio
  run_command :partial_ratio
end

#ratioObject

Compares the entire string similarity, in order.



26
27
28
# File 'lib/match-mate/utils/fuzzy_wuzzy.rb', line 26

def ratio
  run_command :ratio
end

#token_set_ratioObject

Compares the entire string similarity, ignores word order and duplicated words



11
12
13
# File 'lib/match-mate/utils/fuzzy_wuzzy.rb', line 11

def token_set_ratio
  run_command :token_set_ratio
end

#token_sort_ratioObject

Compares the entire string similarity, ignores word order



16
17
18
# File 'lib/match-mate/utils/fuzzy_wuzzy.rb', line 16

def token_sort_ratio
  run_command :token_sort_ratio
end