applyPathKeywords extracts keywords from directory path segments.
(relPath string, cats map[string]struct{})
| 150 | |
| 151 | // applyPathKeywords extracts keywords from directory path segments. |
| 152 | func (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. |
| 170 | func (c *Classifier) applyFilenameKeywords(relPath string, cats map[string]struct{}) { |
no test coverage detected