fix fuzzy dict values view iterator
This commit is contained in:
		
							parent
							
								
									c1a8817fc7
								
							
						
					
					
						commit
						88137751ff
					
				| @ -93,7 +93,7 @@ class FuzzyDictValuesView: | |||||||
|         return item in self._map._values.values() and self._map.filter(item) |         return item in self._map._values.values() and self._map.filter(item) | ||||||
| 
 | 
 | ||||||
|     def __iter__(self): |     def __iter__(self): | ||||||
|         yield from iter(self._map.filtered_items) |         yield from (v for _, v in self._map.filtered_items) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @dataclass | @dataclass | ||||||
| @ -109,6 +109,7 @@ class FuzzyMatchConfig: | |||||||
|         ('c', 'k'): 0.0, |         ('c', 'k'): 0.0, | ||||||
|     }) |     }) | ||||||
|     word_match_weight: float = -0.2 |     word_match_weight: float = -0.2 | ||||||
|  |     whole_match_weight: float = -0.25 | ||||||
|     acronym_match_weight: float = -0.3 |     acronym_match_weight: float = -0.3 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -143,6 +144,7 @@ class FuzzyMatcher: | |||||||
|         match_weight = config.match_weight |         match_weight = config.match_weight | ||||||
|         special_substitution_weights = config.special_substitution_weights |         special_substitution_weights = config.special_substitution_weights | ||||||
|         word_match_weight = config.word_match_weight |         word_match_weight = config.word_match_weight | ||||||
|  |         whole_match_weight = config.whole_match_weight | ||||||
|         acronym_match_weight = config.acronym_match_weight |         acronym_match_weight = config.acronym_match_weight | ||||||
| 
 | 
 | ||||||
|         if not a: |         if not a: | ||||||
| @ -159,7 +161,7 @@ class FuzzyMatcher: | |||||||
|                          word_match_weight * max(sum(a == b for a, b in |                          word_match_weight * max(sum(a == b for a, b in | ||||||
|                                                      zip(source, w[0] + strip_vowels(w[1:]))) for w in |                                                      zip(source, w[0] + strip_vowels(w[1:]))) for w in | ||||||
|                                                  words), |                                                  words), | ||||||
|                          word_match_weight * sum(a == b for a, b in zip(strip_spaces(source), strip_spaces(target))), |                          whole_match_weight * sum(a == b for a, b in zip(strip_spaces(source), strip_spaces(target))), | ||||||
|                          acronym_match_weight * sum( |                          acronym_match_weight * sum( | ||||||
|                              a == b for a, b in zip(source, ''.join(w[0] for w in words)))) |                              a == b for a, b in zip(source, ''.join(w[0] for w in words)))) | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user