Revision: 19233
          http://sourceforge.net/p/gate/code/19233
Author:   domrout
Date:     2016-04-12 12:29:08 +0000 (Tue, 12 Apr 2016)
Log Message:
-----------
Fix bug where context had to be available even if not used

Modified Paths:
--------------
    
gate/trunk/plugins/Crowd_Sourcing/src/gate/crowdsource/classification/EntityClassificationJobBuilder.java

Modified: 
gate/trunk/plugins/Crowd_Sourcing/src/gate/crowdsource/classification/EntityClassificationJobBuilder.java
===================================================================
--- 
gate/trunk/plugins/Crowd_Sourcing/src/gate/crowdsource/classification/EntityClassificationJobBuilder.java
   2016-04-12 01:21:43 UTC (rev 19232)
+++ 
gate/trunk/plugins/Crowd_Sourcing/src/gate/crowdsource/classification/EntityClassificationJobBuilder.java
   2016-04-12 12:29:08 UTC (rev 19233)
@@ -180,21 +180,27 @@
 
         AnnotationSet thisEntityContext =
                 Utils.getCoveringAnnotations(contextAnnotations, entity);
-        if(thisEntityContext.isEmpty()) {
-          log.warn(entityAnnotationType + " with ID " + entity.getId()
-                  + " at offsets (" + Utils.start(entity) + ":"
-                  + Utils.end(entity) + ") in document "
-                  + getDocument().getName() + " has no surrounding "
-                  + contextAnnotationType + " - ignored");
+
+        if (contextASName != null) {
+          if(thisEntityContext.isEmpty()) {
+            log.warn(entityAnnotationType + " with ID " + entity.getId()
+                    + " at offsets (" + Utils.start(entity) + ":"
+                    + Utils.end(entity) + ") in document "
+                    + getDocument().getName() + " has no surrounding "
+                    + contextAnnotationType + " - ignored");
+          } else {
+            // get the "closest" context, i.e. the shortest annotation in
+            // the covering set.
+            // usually we'd expect this set to contain just one annotation
+            Annotation context =
+                    Collections.min(thisEntityContext,
+                            ANNOTATION_LENGTH_COMPARATOR);
+            crowdFlowerClient.createClassificationUnit(jobId, getDocument(),
+                    entityASName, context, entity);
+          }         
         } else {
-          // get the "closest" context, i.e. the shortest annotation in
-          // the covering set.
-          // usually we'd expect this set to contain just one annotation
-          Annotation context =
-                  Collections.min(thisEntityContext,
-                          ANNOTATION_LENGTH_COMPARATOR);
           crowdFlowerClient.createClassificationUnit(jobId, getDocument(),
-                  entityASName, context, entity);
+                  entityASName, entity, entity);
         }
       }
       fireProcessFinished();

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to