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

Method chainB

texteditor/difflib/difflib.go:147–175  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

145}
146
147func (m *SequenceMatcher) chainB() {
148 // Populate line -> index mapping
149 b2j := map[string][]int{}
150 junk := map[string]bool{}
151 popular := map[string]bool{}
152 ntest := len(m.b)
153 if m.autoJunk && ntest >= 200 {
154 ntest = ntest/100 + 1
155 }
156 for i, s := range m.b {
157 if !junk[s] {
158 if m.IsJunk != nil && m.IsJunk(s) {
159 junk[s] = true
160 } else if !popular[s] {
161 ids := append(b2j[s], i)
162 if len(ids) <= ntest {
163 b2j[s] = ids
164 } else {
165 delete(b2j, s)
166 popular[s] = true
167 }
168 }
169 }
170 }
171
172 m.b2j = b2j
173 m.bJunk = junk
174 m.bPopular = popular
175}
176
177func (m *SequenceMatcher) isBJunk(s string) bool {
178 _, ok := m.bJunk[s]

Callers 1

SetSeq2Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected