1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package de.fu_berlin.ties.extract.reestimate;
23
24 import de.fu_berlin.ties.TiesConfiguration;
25
26 /***
27 * A {@link de.fu_berlin.ties.extract.reestimate.LengthEstimator} that uses
28 * the rounded square root of the length (token count) instead of the raw
29 * token count. This representation reduced data sparseness and can be
30 * considered as a kind of smoothing.
31 *
32 * @author Christian Siefkes
33 * @version $Revision: 1.5 $, $Date: 2006/10/21 16:04:17 $, $Author: siefkes $
34 */
35 public class RootLengthEstimator extends LengthEstimator {
36
37 /***
38 * Creates a new instance.
39 *
40 * @param precReestimator the preceding re-estimator to use if this
41 * re-estimator is part of a <em>chain</em>; <code>null</code> otherwise
42 * @param config the configuration to use
43 */
44 public RootLengthEstimator(final Reestimator precReestimator,
45 final TiesConfiguration config) {
46 super(precReestimator, config);
47 }
48
49 /***
50 * {@inheritDoc}
51 */
52 protected double doReestimate(final String type, final int length) {
53
54 return super.doReestimate(type, (int) Math.round(Math.sqrt(length)));
55 }
56
57 /***
58 * {@inheritDoc}
59 */
60 protected void doTrain(final String type, final int length) {
61
62 super.doTrain(type, (int) Math.round(Math.sqrt(length)));
63 }
64
65 }