MCPcopy
hub / github.com/six2dez/OneListForAll / applyPathKeywords

Method applyPathKeywords

internal/classify/classify.go:152–167  ·  view source on GitHub ↗

applyPathKeywords extracts keywords from directory path segments.

(relPath string, cats map[string]struct{})

Source from the content-addressed store, hash-verified

150
151// applyPathKeywords extracts keywords from directory path segments.
152func (c *Classifier) applyPathKeywords(relPath string, cats map[string]struct{}) {
153 // Split path into segments
154 segments := strings.FieldsFunc(filepath.ToSlash(relPath), func(r rune) bool {
155 return r == '/'
156 })
157
158 for _, seg := range segments {
159 // Normalize segment: lowercase, split on separators
160 keywords := splitKeywords(seg)
161 for _, kw := range keywords {
162 if canonical, ok := c.taxonomy.Lookup(kw); ok {
163 cats[canonical] = struct{}{}
164 }
165 }
166 }
167}
168
169// applyFilenameKeywords matches the filename against taxonomy names/aliases.
170func (c *Classifier) applyFilenameKeywords(relPath string, cats map[string]struct{}) {

Callers 1

ClassifyFileMethod · 0.95

Calls 2

splitKeywordsFunction · 0.85
LookupMethod · 0.80

Tested by

no test coverage detected