Project

General

Profile

« Previous | Next » 

Revision 28483

branch 1.2

View differences:

Levenstein.java
1
package eu.dnetlib.pace.distance;
2

  
3
import com.wcohen.ss.AbstractStringDistance;
4

  
5
/**
6
 * The Class Levenstein.
7
 */
8
public class Levenstein extends SecondStringDistanceAlgo {
9

  
10
	/**
11
	 * Instantiates a new levenstein.
12
	 * 
13
	 * @param w
14
	 *            the w
15
	 */
16
	public Levenstein(final double w) {
17
		super(w, new com.wcohen.ss.Levenstein());
18
	}
19

  
20
	/**
21
	 * Instantiates a new levenstein.
22
	 * 
23
	 * @param w
24
	 *            the w
25
	 * @param ssalgo
26
	 *            the ssalgo
27
	 */
28
	protected Levenstein(final double w, final AbstractStringDistance ssalgo) {
29
		super(w, ssalgo);
30
	}
31

  
32
	/*
33
	 * (non-Javadoc)
34
	 * 
35
	 * @see eu.dnetlib.pace.distance.DistanceAlgo#getWeight()
36
	 */
37
	@Override
38
	public double getWeight() {
39
		return super.weight;
40
	}
41

  
42
	/*
43
	 * (non-Javadoc)
44
	 * 
45
	 * @see eu.dnetlib.pace.distance.SecondStringDistanceAlgo#normalize(double)
46
	 */
47
	@Override
48
	protected double normalize(final double d) {
49
		return 1 / Math.pow(Math.abs(d) + 1, 0.1);
50
	}
51

  
52
}

Also available in: Unified diff