ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1861155 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn: ae/WindowBasedAnnotator.java eval/EvaluationOfNeuralJointRelations.java
Date Wed, 12 Jun 2019 16:52:36 GMT
Author: clin
Date: Wed Jun 12 16:52:36 2019
New Revision: 1861155

URL: http://svn.apache.org/viewvc?rev=1861155&view=rev
Log:
update window-based relational annotator and its evaluation

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/WindowBasedAnnotator.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EvaluationOfNeuralJointRelations.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/WindowBasedAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/WindowBasedAnnotator.java?rev=1861155&r1=1861154&r2=1861155&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/WindowBasedAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/WindowBasedAnnotator.java
Wed Jun 12 16:52:36 2019
@@ -1,50 +1,31 @@
 package org.apache.ctakes.temporal.nn.ae;
 
-import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
 
-import org.apache.ctakes.constituency.parser.treekernel.TreeExtractor;
-import org.apache.ctakes.constituency.parser.util.AnnotationTreeUtils;
-import org.apache.ctakes.core.resource.FileLocator;
-import org.apache.ctakes.core.util.OntologyConceptUtil;
 import org.apache.ctakes.temporal.ae.TemporalRelationExtractorAnnotator.IdentifiedAnnotationPair;
 import org.apache.ctakes.temporal.nn.ae.EventTimeTokenBasedAnnotator.OutputMode;
-import org.apache.ctakes.temporal.nn.data.ArgContextProvider;
 import org.apache.ctakes.temporal.utils.TokenPreprocForWord2Vec;
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
 import org.apache.ctakes.typesystem.type.relation.RelationArgument;
 import org.apache.ctakes.typesystem.type.relation.TemporalTextRelation;
 import org.apache.ctakes.typesystem.type.syntax.BaseToken;
-import org.apache.ctakes.typesystem.type.syntax.NewlineToken;
-import org.apache.ctakes.typesystem.type.syntax.TreebankNode;
-import org.apache.ctakes.typesystem.type.syntax.WordToken;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.typesystem.type.textsem.TimeMention;
 import org.apache.ctakes.typesystem.type.textspan.Segment;
-import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.fit.util.JCasUtil;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.tcas.Annotation;
-import org.cleartk.ml.Classifier;
 import org.cleartk.ml.CleartkAnnotator;
-import org.cleartk.ml.CleartkProcessingException;
-import org.cleartk.ml.DataWriter;
 import org.cleartk.ml.Feature;
 import org.cleartk.ml.Instance;
 import org.cleartk.util.ViewUriUtil;
@@ -168,11 +149,11 @@ public class WindowBasedAnnotator extend
 
 			String context;
 			if(arg1 instanceof TimeMention){
-				context = getTokenContext(jCas, arg1, "time", arg2, "event");
+				context = getTokenContext(jCas, arg1, "t", arg2, "e");
 			}else if(arg2 instanceof TimeMention){
-				context = getTokenContext(jCas, arg1, "event", arg2, "time");
+				context = getTokenContext(jCas, arg1, "e", arg2, "t");
 			}else{
-				context = getTokenContext(jCas, arg1, "event a", arg2, "event b");
+				context = getTokenContext(jCas, arg1, "ea", arg2, "eb");
 			}
 
 			List<Feature> feats = new ArrayList<>();
@@ -231,14 +212,14 @@ public class WindowBasedAnnotator extend
 		}
 
 		//arg1
-		tokens.add(type1 + " start");
+		tokens.add(type1 + "s");
 		if (arg1 instanceof TimeMention){
 			String timeTag = generateTimeTag(jCas, (TimeMention)arg1);
 			tokens.add(timeTag);
 		}else{
 			tokens.add(arg1.getCoveredText().replaceAll("[\r\n]"," newline").toLowerCase());//.toLowerCase()
 		}
-		tokens.add(type1 + " end");
+		tokens.add(type1 + "e");
 
 		//tokens in the middle
 		for(BaseToken baseToken :  JCasUtil.selectCovered(jCas, BaseToken.class, arg1.getEnd(),
arg2.getBegin()) ) {
@@ -247,14 +228,14 @@ public class WindowBasedAnnotator extend
 		}
 
 		//arg2
-		tokens.add(type2 + " start");
+		tokens.add(type2 + "s");
 		if (arg2 instanceof TimeMention){
 			String timeTag = generateTimeTag(jCas, (TimeMention)arg2);
 			tokens.add(timeTag);
 		}else{
 			tokens.add(arg2.getCoveredText().replaceAll("[\r\n]"," newline").toLowerCase());//.toLowerCase()
 		}
-		tokens.add(type2 + " end");
+		tokens.add(type2 + "e");
 
 		//two tokens after
 		for(BaseToken baseToken :  JCasUtil.selectFollowing(jCas, BaseToken.class, arg2, 2) ) {

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EvaluationOfNeuralJointRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EvaluationOfNeuralJointRelations.java?rev=1861155&r1=1861154&r2=1861155&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EvaluationOfNeuralJointRelations.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EvaluationOfNeuralJointRelations.java
Wed Jun 12 16:52:36 2019
@@ -34,15 +34,12 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.ctakes.relationextractor.eval.RelationExtractorEvaluation.HashableArguments;
-import org.apache.ctakes.temporal.eval.EvaluationOfEventEventThymeRelations.AddEEPotentialRelations;
 import org.apache.ctakes.temporal.eval.EvaluationOfEventTimeRelations.ParameterSettings;
-import org.apache.ctakes.temporal.eval.EvaluationOfEventTimeRelations.AddPotentialRelations;
 import org.apache.ctakes.temporal.keras.KerasStringOutcomeDataWriter;
 import org.apache.ctakes.temporal.keras.ScriptStringFeatureDataWriter;
 //import org.apache.ctakes.temporal.nn.ae.JointRelationTokenBasedAnnotator;
 //import org.apache.ctakes.temporal.nn.ae.TwoSentenceTokenBasedAnnotator;
 import org.apache.ctakes.temporal.nn.ae.WindowBasedAnnotator;
-import org.apache.ctakes.temporal.nn.ae.WindowBasedCasedAnnotator;
 import org.apache.ctakes.temporal.eval.EvaluationOfTemporalRelations_ImplBase;
 import org.apache.ctakes.temporal.eval.Evaluation_ImplBase;
 import org.apache.ctakes.temporal.eval.I2B2Data;



Mime
View raw message