Просмотр исходного кода

Rename Preprocessor -> ClusteringPreprocessor

Simon Ding 4 лет назад
Родитель
Сommit
0679092b72

+ 2 - 2
jplag/src/main/java/de/jplag/clustering/ClusteringFactory.java

@@ -40,7 +40,7 @@ public class ClusteringFactory {
         }
 
         // init preprocessor
-        Preprocessor preprocessor;
+        ClusteringPreprocessor preprocessor;
         switch (options.getPreprocessor()) {
             case CDF:
                 preprocessor = new CdfPreprocessor();
@@ -58,7 +58,7 @@ public class ClusteringFactory {
         }
         if (preprocessor != null) {
             // Package preprocessor into a clustering algorithm
-            clusteringAlgorithm = new Preprocessor.PreprocessedClusteringAlgorithm(clusteringAlgorithm, preprocessor);
+            clusteringAlgorithm = new ClusteringPreprocessor.PreprocessedClusteringAlgorithm(clusteringAlgorithm, preprocessor);
         }
 
         // init adapter

+ 4 - 4
jplag/src/main/java/de/jplag/clustering/Preprocessor.java → jplag/src/main/java/de/jplag/clustering/ClusteringPreprocessor.java

@@ -15,9 +15,9 @@ import de.jplag.clustering.algorithm.GenericClusteringAlgorithm;
 /**
  * Interface for classes that process similarity matrices before any clustering. Classes implementing this interface
  * must ensure that they do not produce zero rows/columns inside the similarity matrix. They must also be able to
- * calculate the original indices of rows/columns after use through their {@link Preprocessor#postProcessResult} method.
+ * calculate the original indices of rows/columns after use through their {@link ClusteringPreprocessor#postProcessResult} method.
  */
-public interface Preprocessor {
+public interface ClusteringPreprocessor {
     double[][] preprocessSimilarities(double[][] similarityMatrix);
 
     Collection<Collection<Integer>> postProcessResult(Collection<Collection<Integer>> result);
@@ -57,9 +57,9 @@ public interface Preprocessor {
     public static class PreprocessedClusteringAlgorithm implements GenericClusteringAlgorithm {
 
         private final GenericClusteringAlgorithm base;
-        private final Preprocessor preprocessor;
+        private final ClusteringPreprocessor preprocessor;
 
-        public PreprocessedClusteringAlgorithm(GenericClusteringAlgorithm base, Preprocessor preprocessor) {
+        public PreprocessedClusteringAlgorithm(GenericClusteringAlgorithm base, ClusteringPreprocessor preprocessor) {
             this.base = base;
             this.preprocessor = preprocessor;
         }

+ 2 - 2
jplag/src/main/java/de/jplag/clustering/preprocessors/CdfPreprocessor.java

@@ -8,13 +8,13 @@ import org.apache.commons.math3.linear.DefaultRealMatrixPreservingVisitor;
 import org.apache.commons.math3.linear.RealMatrix;
 import org.apache.commons.math3.random.EmpiricalDistribution;
 
-import de.jplag.clustering.Preprocessor;
+import de.jplag.clustering.ClusteringPreprocessor;
 
 /**
  * Multiplies entries of the similarity matrix by their cumulative probability. - Weights that are very low will be
  * (close to) zero - Weights that are very high will be (close to) unchanged
  */
-public class CdfPreprocessor implements Preprocessor {
+public class CdfPreprocessor implements ClusteringPreprocessor {
 
     private PreprocessorHelper helper = new PreprocessorHelper();
 

+ 2 - 2
jplag/src/main/java/de/jplag/clustering/preprocessors/PercentileThresholdProcessor.java

@@ -7,12 +7,12 @@ import org.apache.commons.math3.linear.DefaultRealMatrixPreservingVisitor;
 import org.apache.commons.math3.stat.descriptive.rank.Percentile;
 import org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType;
 
-import de.jplag.clustering.Preprocessor;
+import de.jplag.clustering.ClusteringPreprocessor;
 
 /**
  * Suppresses all similarities below a given percentile.
  */
-public class PercentileThresholdProcessor implements Preprocessor {
+public class PercentileThresholdProcessor implements ClusteringPreprocessor {
 
     private float percentile;
     private ThresholdPreprocessor tp;

+ 2 - 2
jplag/src/main/java/de/jplag/clustering/preprocessors/ThresholdPreprocessor.java

@@ -6,12 +6,12 @@ import org.apache.commons.math3.linear.Array2DRowRealMatrix;
 import org.apache.commons.math3.linear.DefaultRealMatrixChangingVisitor;
 import org.apache.commons.math3.linear.RealMatrix;
 
-import de.jplag.clustering.Preprocessor;
+import de.jplag.clustering.ClusteringPreprocessor;
 
 /**
  * Suppresses all similarities below a given threshold.
  */
-public class ThresholdPreprocessor implements Preprocessor {
+public class ThresholdPreprocessor implements ClusteringPreprocessor {
 
     private double threshold;
     private PreprocessorHelper helper = new PreprocessorHelper();

+ 1 - 1
jplag/src/test/java/de/jplag/clustering/ClusteringTest.java

@@ -85,7 +85,7 @@ public class ClusteringTest {
         URL url = loadFromClasspath("de/jplag/PseudonymizedReports/alt/C_1000_matches_max.csv");
         File file = new File(url.toURI());
         ReadResult r = readOldCsv(file);
-        Preprocessor preprocessor = new CdfPreprocessor();
+        ClusteringPreprocessor preprocessor = new CdfPreprocessor();
         RealMatrix clusteringSimilarity = new Array2DRowRealMatrix(preprocessor.preprocessSimilarities(r.similarity.getData()));
 
         /*