aboutsummaryrefslogtreecommitdiff
path: root/v2/classifier.go
diff options
context:
space:
mode:
Diffstat (limited to 'v2/classifier.go')
-rw-r--r--v2/classifier.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/v2/classifier.go b/v2/classifier.go
index 6dafd51..5e5f8cc 100644
--- a/v2/classifier.go
+++ b/v2/classifier.go
@@ -30,6 +30,7 @@ type Match struct {
Name string
Confidence float64
MatchType string
+ Variant string
StartLine int
EndLine int
StartTokenIndex int
@@ -100,6 +101,7 @@ func (c *Classifier) match(in []byte) Results {
if conf >= c.threshold && (endIndex-startIndex-startOffset-endOffset) > 0 {
candidates = append(candidates, &Match{
Name: LicenseName(l),
+ Variant: variantName(l),
MatchType: detectionType(l),
Confidence: conf,
StartLine: id.Tokens[startIndex+startOffset].Line,
@@ -322,6 +324,11 @@ func detectionType(in string) string {
return splits[0]
}
+func variantName(in string) string {
+ splits := strings.Split(in, fmt.Sprintf("%c", os.PathSeparator))
+ return splits[2]
+}
+
// LicenseName produces the output name for a license, removing the internal structure
// of the filename in use.
func LicenseName(in string) string {