@@ -76,6 +76,9 @@ def logger_debug(*args):
7676# Values of match_coverage less than this are reported as `license_clues` matches
7777CLUES_MATCH_COVERAGE_THR = 60
7878
79+ # Low Relevance threshold
80+ LOW_RELEVANCE_THRESHOLD = 70
81+
7982# False positives to spurious and gibberish texts are found usually later in the file
8083# and matched to relatively short rules
8184# Threshold Value of start line after which a match to likely be a false positive
@@ -104,7 +107,8 @@ class DetectionCategory(Enum):
104107 IMPERFECT_COVERAGE = 'imperfect-match-coverage'
105108 FALSE_POSITVE = 'possible-false-positive'
106109 UNDETECTED_LICENSE = 'undetected-license'
107- MATCH_FRAGMENTS = 'match_fragments'
110+ MATCH_FRAGMENTS = 'match-fragments'
111+ LOW_RELEVANCE = 'low-relevance'
108112
109113
110114class DetectionRule (Enum ):
@@ -924,6 +928,17 @@ def has_extra_words(license_matches):
924928 )
925929
926930
931+ def has_low_rule_relevance (license_matches ):
932+ """
933+ Return True if any on the matches in ``license_matches`` List of LicenseMatch
934+ objects has a match with low score because of low rule relevance.
935+ """
936+ return any (
937+ license_match .rule .relevance < LOW_RELEVANCE_THRESHOLD
938+ for license_match in license_matches
939+ )
940+
941+
927942def is_false_positive (license_matches , package_license = False ):
928943 """
929944 Return True if all of the matches in ``license_matches`` List of LicenseMatch
@@ -1373,6 +1388,9 @@ def get_ambiguous_license_detections_by_type(unique_license_detections):
13731388 elif has_extra_words (license_matches = detection .matches ):
13741389 ambi_license_detections [DetectionCategory .EXTRA_WORDS .value ] = detection
13751390
1391+ elif has_low_rule_relevance (license_matches = detection .matches ):
1392+ ambi_license_detections [DetectionCategory .LOW_RELEVANCE .value ] = detection
1393+
13761394 return ambi_license_detections
13771395
13781396
0 commit comments