Class: FamilyReunion::FuzzyMatcher
- Inherits:
-
Object
- Object
- FamilyReunion::FuzzyMatcher
- Includes:
- MatcherHelper
- Defined in:
- lib/family-reunion/fuzzy_matcher.rb
Instance Method Summary collapse
- #get_synonym_to_synonym_matches ⇒ Object
- #get_synonym_to_valid_matches ⇒ Object
- #get_valid_matches ⇒ Object
- #get_valid_to_synonym_matches ⇒ Object
-
#initialize(family_reunion) ⇒ FuzzyMatcher
constructor
A new instance of FuzzyMatcher.
- #merge ⇒ Object
Constructor Details
#initialize(family_reunion) ⇒ FuzzyMatcher
Returns a new instance of FuzzyMatcher.
5 6 7 8 |
# File 'lib/family-reunion/fuzzy_matcher.rb', line 5 def initialize(family_reunion) @fr = family_reunion @tw = FamilyReunion::TaxamatchWrapper.new end |
Instance Method Details
#get_synonym_to_synonym_matches ⇒ Object
39 40 41 42 43 |
# File 'lib/family-reunion/fuzzy_matcher.rb', line 39 def get_synonym_to_synonym_matches primary_names = @fr.primary_synonyms_set - @fr.secondary_synonyms_set secondary_names = @fr.secondary_synonyms_set - @fr.primary_synonyms_set make_match(primary_names, secondary_names, :synonym, :synonym) end |
#get_synonym_to_valid_matches ⇒ Object
33 34 35 36 37 |
# File 'lib/family-reunion/fuzzy_matcher.rb', line 33 def get_synonym_to_valid_matches primary_names = @fr.primary_synonyms_set - @fr.secondary_valid_names_set secondary_names = @fr.secondary_valid_names_set - @fr.primary_synonyms_set make_match(primary_names, secondary_names, :synonym, :valid_name) end |
#get_valid_matches ⇒ Object
21 22 23 24 25 |
# File 'lib/family-reunion/fuzzy_matcher.rb', line 21 def get_valid_matches primary_names = @fr.primary_valid_names_set - @fr.secondary_valid_names_set secondary_names = @fr.secondary_valid_names_set - @fr.primary_valid_names_set make_match(primary_names, secondary_names, :valid_name, :valid_name) end |
#get_valid_to_synonym_matches ⇒ Object
27 28 29 30 31 |
# File 'lib/family-reunion/fuzzy_matcher.rb', line 27 def get_valid_to_synonym_matches primary_names = @fr.primary_valid_names_set - @fr.secondary_synonyms_set secondary_names = @fr.secondary_synonyms_set - @fr.primary_valid_names_set make_match(primary_names, secondary_names, :valid_name, :synonym) end |
#merge ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/family-reunion/fuzzy_matcher.rb', line 10 def merge FamilyReunion.logger_write(@fr.object_id, "Merging fuzzy matches of accepted names") add_matches(get_valid_matches, :fuzzy_valid_to_valid) FamilyReunion.logger_write(@fr.object_id, "Merging fuzzy matches of accepted names to synonyms") add_matches(get_valid_to_synonym_matches, :fuzzy_valid_to_synonym) FamilyReunion.logger_write(@fr.object_id, "Merging fuzzy matches of synonyms to accepted names") add_matches(get_synonym_to_valid_matches, :fuzzy_synonym_to_valid) FamilyReunion.logger_write(@fr.object_id, "Merging fuzzy matches of synonyms") add_matches(get_synonym_to_synonym_matches, :fuzzy_synonym_to_synonym) end |