Revision: 16656
          http://sourceforge.net/p/gate/code/16656
Author:   adamfunk
Date:     2013-04-23 12:44:16 +0000 (Tue, 23 Apr 2013)
Log Message:
-----------
Conll format: adding support for L-TAG & U-TAG.

Modified Paths:
--------------
    gate/trunk/src/gate/corpora/ConllDocumentFormat.java

Modified: gate/trunk/src/gate/corpora/ConllDocumentFormat.java
===================================================================
--- gate/trunk/src/gate/corpora/ConllDocumentFormat.java        2013-04-23 
01:50:23 UTC (rev 16655)
+++ gate/trunk/src/gate/corpora/ConllDocumentFormat.java        2013-04-23 
12:44:16 UTC (rev 16656)
@@ -112,6 +112,33 @@
             finishAllTags(inProgress, annotanda, oldEnd);
           }
           
+          // "U-FOO": unigram, single-token "FOO"
+          // annotation, after closing any "FOO" already in progress
+          else if ( (items[column].length() > 2) &&
+              items[column].startsWith("U-") ) {
+            String type = items[column].substring(2);
+            finishTag(type, inProgress, annotanda, oldEnd);
+            annotanda.add(new Annotandum(type, start, end, column, true));
+          }
+          
+          // "L-FOO": last bit of "FOO": extend and 
+          // close any "FOO" already in progress
+          else if ( (items[column].length() > 2) &&
+              items[column].startsWith("L-") ) {
+            String type = items[column].substring(2);
+            
+            if (inProgress.containsKey(type)) {
+              // good L-FOO, so update the end offset
+              inProgress.get(type).endOffset = end;
+            }
+            else {
+              // bad data, containing I-FOO without a B-FOO, so treat as if 
B-FOO
+              inProgress.put(type, new Annotandum(type, start, end, column, 
true));
+            }
+
+            finishTag(type, inProgress, annotanda, end);
+          }
+          
           // "B-FOO": start a new "FOO" annotation
           // after closing any "FOO" already in progress
           else if ( (items[column].length() > 2) &&
@@ -138,7 +165,7 @@
           
           // "FOO": treat as single-token annotation (such as POS tag)
           else { 
-            Annotandum tag = new Annotandum(items[1], start, end, column, 
false);
+            Annotandum tag = new Annotandum(items[column], start, end, column, 
false);
             annotanda.add(tag);
           }
         }
@@ -236,7 +263,7 @@
   }
   
   /* Note that chunkiness is determined by the tag structure.  A "B-Foo"
-   * that spans only one token is chunky.  Tags outside the B/I/O system
+   * that spans only one token is chunky.  Tags outside the B/I/L/U system
    * get the kind==token feature; tags in the system get kind==chunky.   */
   protected Annotandum(String type, Long startOffset, Long endOffset, int 
column, boolean chunky) {
     this.features = Factory.newFeatureMap();

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


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to