ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1762498 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn: ae/EventTimeAnnotator.java ae/EventTimeTokenBasedAnnotator.java eval/EventTimeNeuralEvaluation.java eval/EventTimeRelationEvaluation.java
Date Tue, 27 Sep 2016 14:33:12 GMT
Author: dligach
Date: Tue Sep 27 14:33:12 2016
New Revision: 1762498

URL: http://svn.apache.org/viewvc?rev=1762498&view=rev
Log:
refactoring

Added:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventTimeTokenBasedAnnotator.java
      - copied, changed from r1762497, ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventTimeAnnotator.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EventTimeNeuralEvaluation.java
      - copied, changed from r1762497, ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EventTimeRelationEvaluation.java
Removed:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventTimeAnnotator.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EventTimeRelationEvaluation.java

Copied: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventTimeTokenBasedAnnotator.java
(from r1762497, ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventTimeAnnotator.java)
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventTimeTokenBasedAnnotator.java?p2=ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventTimeTokenBasedAnnotator.java&p1=ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventTimeAnnotator.java&r1=1762497&r2=1762498&rev=1762498&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventTimeAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventTimeTokenBasedAnnotator.java
Tue Sep 27 14:33:12 2016
@@ -26,11 +26,11 @@ import org.cleartk.util.ViewUriUtil;
 
 import com.google.common.collect.Lists;
 
-public class EventTimeAnnotator extends CleartkAnnotator<String> {
+public class EventTimeTokenBasedAnnotator extends CleartkAnnotator<String> {
 
   public static final String NO_RELATION_CATEGORY = "none";
 
-  public EventTimeAnnotator() {
+  public EventTimeTokenBasedAnnotator() {
     // TODO Auto-generated constructor stub
   }
 
@@ -42,7 +42,7 @@ public class EventTimeAnnotator extends
     relationLookup = new HashMap<>();
     if(this.isTraining()) {
       relationLookup = new HashMap<>();
-      for (BinaryTextRelation relation : JCasUtil.select(jCas, BinaryTextRelation.class))
{
+      for(BinaryTextRelation relation : JCasUtil.select(jCas, BinaryTextRelation.class))
{
         Annotation arg1 = relation.getArg1().getArgument();
         Annotation arg2 = relation.getArg2().getArgument();
         // The key is a list of args so we can do bi-directional lookup
@@ -69,7 +69,7 @@ public class EventTimeAnnotator extends
         IdentifiedAnnotation arg2 = pair.getArg2();
 
         String context;
-        if (arg2.getBegin() < arg1.getBegin()) {
+        if(arg2.getBegin() < arg1.getBegin()) {
           // ... time ... event ... scenario
           context = EventTimeRelPrinter.getTokenContext(jCas, sentence, arg2, "t", arg1,
"e", 2);
         } else {
@@ -80,14 +80,14 @@ public class EventTimeAnnotator extends
         // derive features based on context
         List<Feature> features = new ArrayList<>();
         String[] tokens = context.split(" ");
-        for (String token: tokens){
+        for(String token: tokens){
           features.add(new Feature(token.toLowerCase()));
         }
 
         // during training, feed the features to the data writer
-        if (this.isTraining()) {
+        if(this.isTraining()) {
           String category = getRelationCategory(relationLookup, arg1, arg2);
-          if (category == null) {
+          if(category == null) {
             category = NO_RELATION_CATEGORY;
           } else{
             category = category.toLowerCase();
@@ -100,10 +100,10 @@ public class EventTimeAnnotator extends
           String predictedCategory = this.classifier.classify(features);
 
           // add a relation annotation if a true relation was predicted
-          if (predictedCategory != null && !predictedCategory.equals(NO_RELATION_CATEGORY))
{
+          if(predictedCategory != null && !predictedCategory.equals(NO_RELATION_CATEGORY))
{
 
             // if we predict an inverted relation, reverse the order of the arguments
-            if (predictedCategory.endsWith("-1")) {
+            if(predictedCategory.endsWith("-1")) {
               predictedCategory = predictedCategory.substring(0, predictedCategory.length()
- 2);
               if(arg1 instanceof TimeMention){
                 IdentifiedAnnotation temp = arg1;

Copied: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EventTimeNeuralEvaluation.java
(from r1762497, ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EventTimeRelationEvaluation.java)
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EventTimeNeuralEvaluation.java?p2=ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EventTimeNeuralEvaluation.java&p1=ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EventTimeRelationEvaluation.java&r1=1762497&r2=1762498&rev=1762498&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EventTimeRelationEvaluation.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eval/EventTimeNeuralEvaluation.java
Tue Sep 27 14:33:12 2016
@@ -87,7 +87,7 @@ import com.google.common.collect.Sets;
 import com.lexicalscope.jewel.cli.CliFactory;
 import com.lexicalscope.jewel.cli.Option;
 
-public class EventTimeRelationEvaluation extends
+public class EventTimeNeuralEvaluation extends
 EvaluationOfTemporalRelations_ImplBase{
   static interface TempRelOptions extends Evaluation_ImplBase.Options{
     @Option
@@ -162,7 +162,7 @@ EvaluationOfTemporalRelations_ImplBase{
         tempModelDir.mkdir();
         workingDir = tempModelDir;
       }
-      EventTimeRelationEvaluation evaluation = new EventTimeRelationEvaluation(
+      EventTimeNeuralEvaluation evaluation = new EventTimeNeuralEvaluation(
           workingDir,
           options.getRawTextDirectory(),
           options.getXMLDirectory(),
@@ -235,7 +235,7 @@ EvaluationOfTemporalRelations_ImplBase{
   protected boolean testOnTrain=false;
   //  protected boolean printRelations = false;
 
-  public EventTimeRelationEvaluation(
+  public EventTimeNeuralEvaluation(
       File baseDirectory,
       File rawTextDirectory,
       File xmlDirectory,



Mime
View raw message