Skip to content
Browse files

Internalized missing dependencies

  • Loading branch information...
1 parent 29c157a commit 4c1eaab8c5e88f2497ed6fffb1ce75d991964d01 @gangeli committed Oct 30, 2012
Showing with 45 additions and 6 deletions.
  1. +3 −3 Makefile
  2. BIN dist/time.jar
  3. +37 −0 src/time/CoreMaps.java
  4. +0 −1 src/time/Data.scala
  5. +5 −2 src/time/Temporal.scala
View
6 Makefile
@@ -20,15 +20,15 @@ ${DIST}/time.jar: ${BUILD}/time/Entry.class
jar uf ${DIST}/time.jar -C $(SRC) .
${BUILD}/time/JITime.class: src/time/JITime.java ${BUILD}/time/Entry.class
- javac -d $(BUILD) -cp $(CP) src/time/O.java
+ javac -d $(BUILD) -cp $(CP) src/time/O.java src/time/CoreMaps.java
${BUILD}/time/Entry.class: ${BUILD}/time/O.class $(wildcard src/time/*.scala)
scalac -deprecation -d ${BUILD} -cp ${CP} `find ${SRC} -name "*.scala"` `find ${SRC} -name "*.java"`
-${BUILD}/time/O.class: src/time/O.java
+${BUILD}/time/O.class: src/time/O.java src/time/CoreMaps.java
mkdir -p ${BUILD}
- javac -d $(BUILD) -cp $(CP) src/time/O.java
+ javac -d $(BUILD) -cp $(CP) src/time/O.java src/time/CoreMaps.java
# -- TESTING --
${DIST}/test.jar: $(wildcard test/src/time/*.java) $(wildcard test/src/time/*.scala) ${DIST}/time.jar
View
BIN dist/time.jar
Binary file not shown.
View
37 src/time/CoreMaps.java
@@ -0,0 +1,37 @@
+package time;
+
+import edu.stanford.nlp.ling.CoreLabel;
+import edu.stanford.nlp.util.*;
+import java.util.*;
+
+class CoreMaps {
+ public static CoreLabel merge(CoreLabel base, CoreLabel toBeMerged){
+ //(variables)
+ CoreLabel rtn = new CoreLabel(base.size());
+ //(copy base)
+ for(Class key : base.keySet()){
+ rtn.set(key,base.get(key));
+ }
+ //(merge)
+ for(Class key : toBeMerged.keySet()){
+ rtn.set(key,toBeMerged.get(key));
+ }
+ //(return)
+ return rtn;
+ }
+
+ public static CoreMap merge(CoreMap base, CoreMap toBeMerged){
+ //(variables)
+ CoreMap rtn = new ArrayCoreMap(base.size());
+ //(copy base)
+ for(Class key : base.keySet()){
+ rtn.set(key, base.get(key));
+ }
+ //(merge)
+ for(Class key : toBeMerged.keySet()){
+ rtn.set(key,toBeMerged.get(key));
+ }
+ //(return)
+ return rtn;
+ }
+}
View
1 src/time/Data.scala
@@ -14,7 +14,6 @@ import edu.stanford.nlp.util.logging.Redwood.Util._
import edu.stanford.nlp.util.logging.StanfordRedwoodConfiguration;
import edu.stanford.nlp.util.CoreMap
import edu.stanford.nlp.util.ArrayCoreMap
-import edu.stanford.nlp.util.CoreMaps
import edu.stanford.nlp.ling.CoreLabel
import edu.stanford.nlp.ling.CoreAnnotation
import edu.stanford.nlp.ling.CoreAnnotations._
View
7 src/time/Temporal.scala
@@ -1,5 +1,6 @@
package time
+import scala.collection.JavaConversions._
import scala.collection.mutable.ArrayBuffer
import scala.collection.mutable.Map
import scala.collection.mutable.ListMap
@@ -12,7 +13,6 @@ import org.joda.time._
import edu.stanford.nlp.stats.ClassicCounter
import edu.stanford.nlp.stats.Counter
-import edu.stanford.nlp.stats.Counters
import edu.stanford.nlp.util.logging.Redwood.Util._
import edu.stanford.nlp.time.JodaTimeUtils
@@ -1614,7 +1614,10 @@ object Sequence {
}
}
//(normalize)
- Counters.normalize(data)
+ val totalCount = data.totalCount
+ for ( key <- data.keySet ) {
+ data.setCount(key, data.getCount(key) / totalCount)
+ }
val counts:Counter[Long] = data
data = new ClassicCounter[Long]()
//(debug)

0 comments on commit 4c1eaab

Please sign in to comment.
Something went wrong with that request. Please try again.