ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1702112 - in /ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes: bootstrap/NarrativeContainers.java index/SearchUtility.java pipelines/BasicPipeline.java
Date Wed, 09 Sep 2015 21:12:16 GMT
Author: dligach
Date: Wed Sep  9 21:12:16 2015
New Revision: 1702112

URL: http://svn.apache.org/r1702112
Log:
now looking for events only within sentence boundaries

Modified:
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/bootstrap/NarrativeContainers.java
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/index/SearchUtility.java
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/BasicPipeline.java

Modified: ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/bootstrap/NarrativeContainers.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/bootstrap/NarrativeContainers.java?rev=1702112&r1=1702111&r2=1702112&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/bootstrap/NarrativeContainers.java
(original)
+++ ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/bootstrap/NarrativeContainers.java
Wed Sep  9 21:12:16 2015
@@ -69,13 +69,15 @@ public class NarrativeContainers {
     
     @Override
     public void process(JCas jCas) throws AnalysisEngineProcessException {
-
+      
       for(Sentence sentence : JCasUtil.select(jCas, Sentence.class)) {
         for(WordToken word : JCasUtil.selectCovered(jCas, WordToken.class, sentence)) {
           if(word.getCoveredText().equals(anchor)) {
-            EventMention nearestEvent = getNearestEventMention(jCas, word);
+            EventMention nearestEvent = getNearestEventMention(jCas, word, sentence);
             if(nearestEvent != null) {
+              System.out.println(sentence.getCoveredText());
               System.out.println(nearestEvent.getCoveredText());
+              System.out.println();
             }
           } 
         }
@@ -86,7 +88,7 @@ public class NarrativeContainers {
      * Find nearest event mention on the right of a word token. 
      * Must be within allowable distance. Return null if none found.
      */
-    private static EventMention getNearestEventMention(JCas jCas, WordToken word) {
+    private static EventMention getNearestEventMention(JCas jCas, WordToken word, Sentence
sentence) {
 
       List<EventMention> eventMentions = JCasUtil.selectFollowing(jCas, EventMention.class,
word, 1);
       if(eventMentions.size() < 1) {
@@ -94,6 +96,9 @@ public class NarrativeContainers {
       }
 
       EventMention nearestEventMention = eventMentions.get(0);
+      if((nearestEventMention.getBegin() < sentence.getBegin()) || (nearestEventMention.getBegin()
> sentence.getEnd())) {
+        return null;
+      }
       int distance = JCasUtil.selectBetween(jCas, WordToken.class, word, nearestEventMention).size();
       if(distance > maxDistance) {
         return null;

Modified: ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/index/SearchUtility.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/index/SearchUtility.java?rev=1702112&r1=1702111&r2=1702112&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/index/SearchUtility.java (original)
+++ ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/index/SearchUtility.java Wed
Sep  9 21:12:16 2015
@@ -17,7 +17,7 @@ import org.apache.lucene.store.FSDirecto
 
 public class SearchUtility {
   
-  public static final boolean printEntireDocument = false;
+  public static final boolean printEntireDocument = true;
   public static final int contextWindowInCharacters = 30;
   
   public static void main(String[] args) throws IOException {

Modified: ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/BasicPipeline.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/BasicPipeline.java?rev=1702112&r1=1702111&r2=1702112&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/BasicPipeline.java
(original)
+++ ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/BasicPipeline.java
Wed Sep  9 21:12:16 2015
@@ -58,8 +58,8 @@ import com.google.common.io.CharStreams;
 
 public class BasicPipeline {
 
-  public static File inputDirectory = new File("/Users/dima/Boston/Data/DeepPhe/Text/");
-  public static String outputDirectory = "/Users/dima/Boston/Data/DeepPhe/Xmi/";
+  public static File inputDirectory = new File("/Users/dima/Boston/Out/Text/");
+  public static String outputDirectory = "/Users/dima/Boston/Out/Xmi/";
 
   public static void main(String[] args) throws Exception {
 



Mime
View raw message