MCPcopy Index your code
hub / github.com/expr-lang/expr / chainB

Method chainB

internal/difflib/difflib.go:151–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149}
150
151func (m *SequenceMatcher) chainB() {
152 // Populate line -> index mapping
153 b2j := map[string][]int{}
154 for i, s := range m.b {
155 indices := b2j[s]
156 indices = append(indices, i)
157 b2j[s] = indices
158 }
159
160 // Purge junk elements
161 m.bJunk = map[string]struct{}{}
162 if m.IsJunk != nil {
163 junk := m.bJunk
164 for s, _ := range b2j {
165 if m.IsJunk(s) {
166 junk[s] = struct{}{}
167 }
168 }
169 for s, _ := range junk {
170 delete(b2j, s)
171 }
172 }
173
174 // Purge remaining popular elements
175 popular := map[string]struct{}{}
176 n := len(m.b)
177 if m.autoJunk && n >= 200 {
178 ntest := n/100 + 1
179 for s, indices := range b2j {
180 if len(indices) > ntest {
181 popular[s] = struct{}{}
182 }
183 }
184 for s, _ := range popular {
185 delete(b2j, s)
186 }
187 }
188 m.bPopular = popular
189 m.b2j = b2j
190}
191
192func (m *SequenceMatcher) isBJunk(s string) bool {
193 _, ok := m.bJunk[s]

Callers 1

SetSeq2Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected