<p>截至2017年6月,<code>fuzzywuzzy</code>还包括一些其他比较函数。以下是已接受答案中缺少的部分的概述(摘自<a href="https://github.com/seatgeek/fuzzywuzzy/blob/master/fuzzywuzzy/fuzz.py" rel="noreferrer">source code</a>):</p>
<h2>fuzz.partial_token_sort_比率</h2>
<p>与<code>token_sort_ratio</code>中的算法相同,但在对令牌进行排序后,不应用<code>ratio</code>,而是使用<code>partial_ratio</code>。</p>
<pre><code>fuzz.token_sort_ratio("New York Mets vs Braves", "Atlanta Braves vs New York Mets")
> 85
fuzz.partial_token_sort_ratio("New York Mets vs Braves", "Atlanta Braves vs New York Mets")
> 100
fuzz.token_sort_ratio("React.js framework", "React.js")
> 62
fuzz.partial_token_sort_ratio("React.js framework", "React.js")
> 100
</code></pre>
<h2>fuzz.partial_token_set_比率</h2>
<p>与<code>token_set_ratio</code>中的算法相同,但不是对令牌集应用<code>ratio</code>,而是使用<code>partial_ratio</code>。</p>
<pre><code>fuzz.token_set_ratio("New York Mets vs Braves", "Atlanta vs New York Mets")
> 82
fuzz.partial_token_set_ratio("New York Mets vs Braves", "Atlanta vs New York Mets")
> 100
fuzz.token_set_ratio("React.js framework", "Reactjs")
> 40
fuzz.partial_token_set_ratio("React.js framework", "Reactjs")
> 71
</code></pre>
<h2>模糊.QRatio,模糊.UQRatio</h2>
<p>只需在<code>fuzz.ratio</code>周围包装一些验证和短路,这里包括完整性。
<code>UQRatio</code>是<code>QRatio</code>的unicode版本。</p>
<h2>绒毛包装</h2>
<p>尝试加权(名称代表“加权比率”)的结果来自不同的算法
计算“最佳”分数。
源代码中的说明:</p>
<pre><code>1. Take the ratio of the two processed strings (fuzz.ratio)
2. Run checks to compare the length of the strings
* If one of the strings is more than 1.5 times as long as the other
use partial_ratio comparisons - scale partial results by 0.9
(this makes sure only full results can return 100)
* If one of the strings is over 8 times as long as the other
instead scale by 0.6
3. Run the other ratio functions
* if using partial ratio functions call partial_ratio,
partial_token_sort_ratio and partial_token_set_ratio
scale all of these by the ratio based on length
* otherwise call token_sort_ratio and token_set_ratio
* all token based comparisons are scaled by 0.95
(on top of any partial scalars)
4. Take the highest value from these results
round it and return it as an integer.
</code></pre>
<h2>模糊率</h2>
<p><code>WRatio</code>的Unicode版本。</p>