RealQuickRatio returns an upper bound on ratio() very quickly. This isn't defined beyond that it is an upper bound on .Ratio(), and is faster to compute than either .Ratio() or .QuickRatio().
()
| 516 | // This isn't defined beyond that it is an upper bound on .Ratio(), and |
| 517 | // is faster to compute than either .Ratio() or .QuickRatio(). |
| 518 | func (m *SequenceMatcher) RealQuickRatio() float64 { |
| 519 | la, lb := len(m.a), len(m.b) |
| 520 | return calculateRatio(min(la, lb), la+lb) |
| 521 | } |
| 522 | |
| 523 | func count_leading(line string, ch byte) (count int) { |
| 524 | // Return number of `ch` characters at the start of `line`. |