This commit is contained in:
Luis Gonzalez 2023-07-17 21:38:59 -05:00 committed by GitHub
commit 281c33ac0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,13 +65,12 @@ public class StringMapBasedLinearModel implements MapBasedLinearModel<String> {
public float score(Map<String, Float> values) { public float score(Map<String, Float> values) {
float score = 0.0f; float score = 0.0f;
for (Map.Entry<String, Float> value : values.entrySet()) { for (Map.Entry<String, Float> value : values.entrySet()) {
String featureName = value.getKey(); float weight = getWeight(value.getKey());
float weight = getWeight(featureName);
if (weight != 0.0f) { if (weight != 0.0f) {
score += weight * value.getValue(); score += weight * value.getValue();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug(String.format("%s = %.3f * %.3f = %.3f, ", LOG.debug(String.format("%s = %.3f * %.3f = %.3f, ",
featureName, weight, value.getValue(), value.getKey(), weight, value.getValue(),
weight * value.getValue())); weight * value.getValue()));
} }
} }