mirror of https://github.com/MISP/MISP
fix: [decaying] 2-tag base_score ratio. Fix #6352
parent
d0c7c44a2f
commit
25a58578ba
|
@ -106,7 +106,7 @@ abstract class DecayingModelBase
|
|||
$flag_contain_matching_taxonomy = false;
|
||||
if (!empty($taxonomy_effective_ratios)) {
|
||||
foreach ($tags as $k => $tag) {
|
||||
$taxonomy = explode('=', $tag['Tag']['name'])[0];
|
||||
$taxonomy = $this->__extractTagBasename($tag['Tag']['name'])['base'];
|
||||
if (isset($taxonomy_effective_ratios[$taxonomy])) {
|
||||
$flag_contain_matching_taxonomy = true;
|
||||
$base_score += $taxonomy_effective_ratios[$taxonomy] * $tag['Tag']['numerical_value'];
|
||||
|
|
|
@ -548,11 +548,11 @@
|
|||
if (tag === false) {
|
||||
return ['', '', '', this.base_score.toFixed(2)];
|
||||
}
|
||||
var namespace = tag.Tag.name.split('=')[0];
|
||||
var basename = this._extractTagPart(tag.Tag.name);
|
||||
|
||||
if (this.base_score_config.taxonomy_effective_ratios[namespace] !== undefined) {
|
||||
var html1 = this.base_score_config.taxonomy_effective_ratios[namespace].toFixed(2);
|
||||
var html4 = (parseFloat(tag.Tag.numerical_value) * this.base_score_config.taxonomy_effective_ratios[namespace]).toFixed(2);
|
||||
if (this.base_score_config.taxonomy_effective_ratios[basename] !== undefined) {
|
||||
var html1 = this.base_score_config.taxonomy_effective_ratios[basename].toFixed(2);
|
||||
var html4 = (parseFloat(tag.Tag.numerical_value) * this.base_score_config.taxonomy_effective_ratios[basename]).toFixed(2);
|
||||
} else {
|
||||
var html1 = '0';
|
||||
var html4 = '0';
|
||||
|
@ -639,6 +639,18 @@
|
|||
}
|
||||
this.$container;
|
||||
},
|
||||
|
||||
_extractTagPart: function(tag) {
|
||||
var reTag = /^(?<namespace>[^:="]+):(?<predicate>[^:="]+)(="(?<value>[^:="]+)")?$/
|
||||
var result = tag.match(reTag);
|
||||
var tagBaseName = '';
|
||||
if (result.groups.value !== undefined) {
|
||||
tagBaseName = result.groups.namespace + ':' + result.groups.predicate;
|
||||
} else {
|
||||
tagBaseName = result.groups.namespace;
|
||||
}
|
||||
return tagBaseName;
|
||||
}
|
||||
}
|
||||
|
||||
$.BasescoreComputationTable = BasescoreComputationTable;
|
||||
|
|
Loading…
Reference in New Issue