You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@joshua.apache.org by mj...@apache.org on 2016/08/24 19:45:35 UTC
[14/41] incubator-joshua git commit: JOSHUA-302 - Remove dependency
on concurrent/concurrent package; replace instances with JDK library builtins
JOSHUA-302 - Remove dependency on concurrent/concurrent package; replace instances with JDK library builtins
Project: http://git-wip-us.apache.org/repos/asf/incubator-joshua/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-joshua/commit/19fe7561
Tree: http://git-wip-us.apache.org/repos/asf/incubator-joshua/tree/19fe7561
Diff: http://git-wip-us.apache.org/repos/asf/incubator-joshua/diff/19fe7561
Branch: refs/heads/JOSHUA-304
Commit: 19fe7561aa516b1a7eba63473e8d26111a708c33
Parents: 2e2ee09
Author: Max Thomas <ma...@maxthomas.io>
Authored: Wed Aug 17 10:32:20 2016 -0500
Committer: Max Thomas <ma...@maxthomas.io>
Committed: Wed Aug 17 10:32:20 2016 -0500
----------------------------------------------------------------------
pom.xml | 5 -----
.../org/apache/joshua/adagrad/AdaGradCore.java | 22 ++++++++++----------
.../java/org/apache/joshua/pro/PROCore.java | 22 ++++++++++----------
3 files changed, 22 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/19fe7561/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 49d77fb..05af17a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -231,11 +231,6 @@
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
- <dependency>
- <groupId>concurrent</groupId>
- <artifactId>concurrent</artifactId>
- <version>1.3.4</version>
- </dependency>
<!-- Test Dependencies -->
<dependency>
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/19fe7561/src/main/java/org/apache/joshua/adagrad/AdaGradCore.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/joshua/adagrad/AdaGradCore.java b/src/main/java/org/apache/joshua/adagrad/AdaGradCore.java
index 789757f..e51e8a3 100755
--- a/src/main/java/org/apache/joshua/adagrad/AdaGradCore.java
+++ b/src/main/java/org/apache/joshua/adagrad/AdaGradCore.java
@@ -40,6 +40,7 @@ import java.util.Random;
import java.util.Scanner;
import java.util.TreeSet;
import java.util.Vector;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
@@ -49,7 +50,6 @@ import org.apache.joshua.decoder.JoshuaConfiguration;
import org.apache.joshua.metrics.EvaluationMetric;
import org.apache.joshua.util.StreamGobbler;
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -719,7 +719,7 @@ public class AdaGradCore {
candCount[i] = 0;
lastUsedIndex[i] = -1;
// suffStats_array[i].clear();
- suffStats_array[i] = new ConcurrentHashMap();
+ suffStats_array[i] = new ConcurrentHashMap<>();
}
// initLambda[0] is not used!
@@ -1539,7 +1539,7 @@ public class AdaGradCore {
/*
* line format:
- *
+ *
* i ||| words of candidate translation . ||| feat-1_val feat-2_val ... feat-numParams_val
* .*
*/
@@ -1922,13 +1922,13 @@ public class AdaGradCore {
/*
* InputStream inStream = new FileInputStream(new File(origFileName)); BufferedReader inFile =
* new BufferedReader(new InputStreamReader(inStream, "utf8"));
- *
+ *
* FileOutputStream outStream = new FileOutputStream(newFileName, false); OutputStreamWriter
* outStreamWriter = new OutputStreamWriter(outStream, "utf8"); BufferedWriter outFile = new
* BufferedWriter(outStreamWriter);
- *
+ *
* String line; while(inFile.ready()) { line = inFile.readLine(); writeLine(line, outFile); }
- *
+ *
* inFile.close(); outFile.close();
*/
return true;
@@ -2026,10 +2026,10 @@ public class AdaGradCore {
/*
* OBSOLETE MODIFICATION //SPECIAL HANDLING FOR AdaGrad CLASSIFIER PARAMETERS String[]
* paramA = line.split("\\s+");
- *
+ *
* if( paramA[0].equals("-classifierParams") ) { String classifierParam = ""; for(int p=1;
* p<=paramA.length-1; p++) classifierParam += paramA[p]+" ";
- *
+ *
* if(paramA.length>=2) { String[] tmpParamA = new String[2]; tmpParamA[0] = paramA[0];
* tmpParamA[1] = classifierParam; paramA = tmpParamA; } else {
* println("Malformed line in config file:"); println(origLine); System.exit(70); } }//END
@@ -2572,12 +2572,12 @@ public class AdaGradCore {
/*
* 1: -docSet bottom 8d 2: -docSet bottom 25% the bottom ceil(0.20*numDocs) documents 3: -docSet
* top 8d 4: -docSet top 25% the top ceil(0.20*numDocs) documents
- *
+ *
* 5: -docSet window 11d around 90percentile 11 docs centered around 80th percentile (complain
* if not enough docs; don't adjust) 6: -docSet window 11d around 40rank 11 docs centered around
* doc ranked 50 (complain if not enough docs; don't adjust)
- *
- *
+ *
+ *
* [0]: method (0-6) [1]: first (1-indexed) [2]: last (1-indexed) [3]: size [4]: center [5]:
* arg1 (-1 for method 0) [6]: arg2 (-1 for methods 0-4)
*/
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/19fe7561/src/main/java/org/apache/joshua/pro/PROCore.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/joshua/pro/PROCore.java b/src/main/java/org/apache/joshua/pro/PROCore.java
index 290000d..ec23e0a 100755
--- a/src/main/java/org/apache/joshua/pro/PROCore.java
+++ b/src/main/java/org/apache/joshua/pro/PROCore.java
@@ -40,6 +40,7 @@ import java.util.Random;
import java.util.Scanner;
import java.util.TreeSet;
import java.util.Vector;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
@@ -49,7 +50,6 @@ import org.apache.joshua.decoder.JoshuaConfiguration;
import org.apache.joshua.metrics.EvaluationMetric;
import org.apache.joshua.util.StreamGobbler;
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -713,7 +713,7 @@ public class PROCore {
candCount[i] = 0;
lastUsedIndex[i] = -1;
// suffStats_array[i].clear();
- suffStats_array[i] = new ConcurrentHashMap();
+ suffStats_array[i] = new ConcurrentHashMap<>();
}
// initLambda[0] is not used!
@@ -1503,7 +1503,7 @@ public class PROCore {
/*
* line format:
- *
+ *
* i ||| words of candidate translation . ||| feat-1_val feat-2_val ... feat-numParams_val
* .*
*/
@@ -1886,13 +1886,13 @@ public class PROCore {
/*
* InputStream inStream = new FileInputStream(new File(origFileName)); BufferedReader inFile =
* new BufferedReader(new InputStreamReader(inStream, "utf8"));
- *
+ *
* FileOutputStream outStream = new FileOutputStream(newFileName, false); OutputStreamWriter
* outStreamWriter = new OutputStreamWriter(outStream, "utf8"); BufferedWriter outFile = new
* BufferedWriter(outStreamWriter);
- *
+ *
* String line; while(inFile.ready()) { line = inFile.readLine(); writeLine(line, outFile); }
- *
+ *
* inFile.close(); outFile.close();
*/
return true;
@@ -1990,10 +1990,10 @@ public class PROCore {
/*
* OBSOLETE MODIFICATION //SPECIAL HANDLING FOR PRO CLASSIFIER PARAMETERS String[] paramA
* = line.split("\\s+");
- *
+ *
* if( paramA[0].equals("-classifierParams") ) { String classifierParam = ""; for(int p=1;
* p<=paramA.length-1; p++) classifierParam += paramA[p]+" ";
- *
+ *
* if(paramA.length>=2) { String[] tmpParamA = new String[2]; tmpParamA[0] = paramA[0];
* tmpParamA[1] = classifierParam; paramA = tmpParamA; } else {
* println("Malformed line in config file:"); println(origLine); System.exit(70); } }//END
@@ -2474,12 +2474,12 @@ public class PROCore {
/*
* 1: -docSet bottom 8d 2: -docSet bottom 25% the bottom ceil(0.20*numDocs) documents 3: -docSet
* top 8d 4: -docSet top 25% the top ceil(0.20*numDocs) documents
- *
+ *
* 5: -docSet window 11d around 90percentile 11 docs centered around 80th percentile (complain
* if not enough docs; don't adjust) 6: -docSet window 11d around 40rank 11 docs centered around
* doc ranked 50 (complain if not enough docs; don't adjust)
- *
- *
+ *
+ *
* [0]: method (0-6) [1]: first (1-indexed) [2]: last (1-indexed) [3]: size [4]: center [5]:
* arg1 (-1 for method 0) [6]: arg2 (-1 for methods 0-4)
*/