MCPcopy Create free account
hub / github.com/cogentcore/core / RealQuickRatio

Method RealQuickRatio

texteditor/difflib/difflib.go:518–521  ·  view source on GitHub ↗

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().

()

Source from the content-addressed store, hash-verified

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().
518func (m *SequenceMatcher) RealQuickRatio() float64 {
519 la, lb := len(m.a), len(m.b)
520 return calculateRatio(min(la, lb), la+lb)
521}
522
523func count_leading(line string, ch byte) (count int) {
524 // Return number of `ch` characters at the start of `line`.

Callers 3

TestSequenceMatcherRatioFunction · 0.45
FancyReplaceMethod · 0.45

Calls 1

calculateRatioFunction · 0.70

Tested by 2

TestSequenceMatcherRatioFunction · 0.36