Skip to content
Myr

Fix spelling error (Extention -> Extension) (#2589)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Keating950 · committed by GitHub · parent 9bd8988 · Browse files · 2 files+18 added−18 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+18 added−18 removed

  • other:+18 added−18 removed

2 files+18 added−18 removed

modified:src/algo/algo_test.go+11 added-11 removed
41 unmodified lines
42func TestFuzzyMatch(t *testing.T) {43 for _, fn := range []Algo{FuzzyMatchV1, FuzzyMatchV2} {44 for _, forward := range []bool{true, false} {45 assertMatch(t, fn, false, forward, "fooBarbaz1", "oBZ", 2, 9,46 scoreMatch*3+bonusCamel123+scoreGapStart+scoreGapExtention*3)46 scoreMatch*3+bonusCamel123+scoreGapStart+scoreGapExtension*3)47 assertMatch(t, fn, false, forward, "foo bar baz", "fbb", 0, 9,48 scoreMatch*3+bonusBoundary*bonusFirstCharMultiplier+49 bonusBoundary*2+2*scoreGapStart+4*scoreGapExtention)49 bonusBoundary*2+2*scoreGapStart+4*scoreGapExtension)50 assertMatch(t, fn, false, forward, "/AutomatorDocument.icns", "rdoc", 9, 13,51 scoreMatch*4+bonusCamel123+bonusConsecutive*2)52 assertMatch(t, fn, false, forward, "/man1/zshcompctl.1", "zshc", 6, 10,53 scoreMatch*4+bonusBoundary*bonusFirstCharMultiplier+bonusBoundary*3)54 assertMatch(t, fn, false, forward, "/.oh-my-zsh/cache", "zshc", 8, 13,55 scoreMatch*4+bonusBoundary*bonusFirstCharMultiplier+bonusBoundary*3+scoreGapStart)56 assertMatch(t, fn, false, forward, "ab0123 456", "12356", 3, 10,57 scoreMatch*5+bonusConsecutive*3+scoreGapStart+scoreGapExtention)57 scoreMatch*5+bonusConsecutive*3+scoreGapStart+scoreGapExtension)58 assertMatch(t, fn, false, forward, "abc123 456", "12356", 3, 10,59 scoreMatch*5+bonusCamel123*bonusFirstCharMultiplier+bonusCamel123*2+bonusConsecutive+scoreGapStart+scoreGapExtention)59 scoreMatch*5+bonusCamel123*bonusFirstCharMultiplier+bonusCamel123*2+bonusConsecutive+scoreGapStart+scoreGapExtension)60 assertMatch(t, fn, false, forward, "foo/bar/baz", "fbb", 0, 9,61 scoreMatch*3+bonusBoundary*bonusFirstCharMultiplier+62 bonusBoundary*2+2*scoreGapStart+4*scoreGapExtention)62 bonusBoundary*2+2*scoreGapStart+4*scoreGapExtension)63 assertMatch(t, fn, false, forward, "fooBarBaz", "fbb", 0, 7,64 scoreMatch*3+bonusBoundary*bonusFirstCharMultiplier+65 bonusCamel123*2+2*scoreGapStart+2*scoreGapExtention)65 bonusCamel123*2+2*scoreGapStart+2*scoreGapExtension)66 assertMatch(t, fn, false, forward, "foo barbaz", "fbb", 0, 8,67 scoreMatch*3+bonusBoundary*bonusFirstCharMultiplier+bonusBoundary+68 scoreGapStart*2+scoreGapExtention*3)68 scoreGapStart*2+scoreGapExtension*3)69 assertMatch(t, fn, false, forward, "fooBar Baz", "foob", 0, 4,70 scoreMatch*4+bonusBoundary*bonusFirstCharMultiplier+bonusBoundary*3)71 assertMatch(t, fn, false, forward, "xFoo-Bar Baz", "foo-b", 1, 6,72 scoreMatch*5+bonusCamel123*bonusFirstCharMultiplier+bonusCamel123*2+73 bonusNonWord+bonusBoundary)7475 assertMatch(t, fn, true, forward, "fooBarbaz", "oBz", 2, 9,76 scoreMatch*3+bonusCamel123+scoreGapStart+scoreGapExtention*3)76 scoreMatch*3+bonusCamel123+scoreGapStart+scoreGapExtension*3)77 assertMatch(t, fn, true, forward, "Foo/Bar/Baz", "FBB", 0, 9,78 scoreMatch*3+bonusBoundary*(bonusFirstCharMultiplier+2)+79 scoreGapStart*2+scoreGapExtention*4)79 scoreGapStart*2+scoreGapExtension*4)80 assertMatch(t, fn, true, forward, "FooBarBaz", "FBB", 0, 7,81 scoreMatch*3+bonusBoundary*bonusFirstCharMultiplier+bonusCamel123*2+82 scoreGapStart*2+scoreGapExtention*2)82 scoreGapStart*2+scoreGapExtension*2)83 assertMatch(t, fn, true, forward, "FooBar Baz", "FooB", 0, 4,84 scoreMatch*4+bonusBoundary*bonusFirstCharMultiplier+bonusBoundary*2+85 util.Max(bonusCamel123, bonusBoundary))86
11 unmodified lines
9899func TestFuzzyMatchBackward(t *testing.T) {100 assertMatch(t, FuzzyMatchV1, false, true, "foobar fb", "fb", 0, 4,101 scoreMatch*2+bonusBoundary*bonusFirstCharMultiplier+102 scoreGapStart+scoreGapExtention)102 scoreGapStart+scoreGapExtension)103 assertMatch(t, FuzzyMatchV1, false, false, "foobar fb", "fb", 7, 9,104 scoreMatch*2+bonusBoundary*bonusFirstCharMultiplier+bonusBoundary)105}106
91 unmodified lines
modified:src/algo/algo.go+7 added-7 removed
105 unmodified lines
106107const (108 scoreMatch = 16109 scoreGapStart = -3110 scoreGapExtention = -1110 scoreGapExtension = -1111112 // We prefer matches at the beginning of a word, but the bonus should not be113 // too great to prevent the longer acronym matches from always winning over114 // shorter fuzzy matches. The bonus point here was specifically chosen that
9 unmodified lines
124125 // Edge-triggered bonus for matches in camelCase words.126 // Compared to word-boundary case, they don't accompany single-character gaps127 // (e.g. FooBar vs. foo-bar), so we deduct bonus point accordingly.128 bonusCamel123 = bonusBoundary + scoreGapExtention128 bonusCamel123 = bonusBoundary + scoreGapExtension129130 // Minimum bonus point given to characters in consecutive chunks.131 // Note that bonus points for consecutive matches shouldn't have needed if we132 // used fixed match score as in the original algorithm.133 bonusConsecutive = -(scoreGapStart + scoreGapExtention)133 bonusConsecutive = -(scoreGapStart + scoreGapExtension)134135 // The first character in the typed pattern usually has more significance136 // than the rest so it's important that it appears at special positions where137 // bonus points are given. e.g. "to-go" vs. "ongoing" on "og" or on "ogo".137 // bonus points are given, e.g. "to-go" vs. "ongoing" on "og" or on "ogo".138 // The amount of the extra bonus should be limited so that the gap penalty is139 // still respected.140 bonusFirstCharMultiplier = 2141)
281 unmodified lines
423 }424 inGap = false425 } else {426 if inGap {427 H0sub[off] = util.Max16(prevH0+scoreGapExtention, 0)427 H0sub[off] = util.Max16(prevH0+scoreGapExtension, 0)428 } else {429 H0sub[off] = util.Max16(prevH0+scoreGapStart, 0)430 }431 C0sub[off] = 0
44 unmodified lines
476 col := off + f477 var s1, s2, consecutive int16478479 if inGap {480 s2 = Hleft[off] + scoreGapExtention480 s2 = Hleft[off] + scoreGapExtension481 } else {482 s2 = Hleft[off] + scoreGapStart483 }484
112 unmodified lines
597 consecutive++598 pidx++599 } else {600 if inGap {601 score += scoreGapExtention601 score += scoreGapExtension602 } else {603 score += scoreGapStart604 }605 inGap = true
279 unmodified lines