fr.univnantes.termsuite.metrics.LinearNormalizer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of termsuite-core Show documentation
Show all versions of termsuite-core Show documentation
A Java UIMA-based toolbox for multilingual and efficient terminology extraction an multilingual term alignment
The newest version!
package fr.univnantes.termsuite.metrics;
/**
*
* Operates a linear normalization to range [0,1].
*
* y = a.x + b
*
* If the result of the linear function is greater
* (resp. lower) than 1 (resp. 0), its normalized value
* returned will be 1 (resp. 0)
*
* @author Damien Cram
*
*/
public class LinearNormalizer implements Normalizer {
private double a;
private double b;
public LinearNormalizer(double a, double b) {
super();
this.a = a;
this.b = b;
}
@Override
public double normalize(double value) {
return Math.min(1, Math.max(0,a * value + b));
}
}