ASF GitHub Bot commented on OPENNLP-1193:

kottmann commented on a change in pull request #311: OPENNLP-1193 Add support 
for multi fragment annotatiosn
URL: https://github.com/apache/opennlp/pull/311#discussion_r181372067

 File path: 
 @@ -17,20 +17,23 @@
 package opennlp.tools.formats.brat;
+import java.util.Arrays;
 import opennlp.tools.util.Span;
 public class SpanAnnotation extends BratAnnotation {
-  private final Span span;
+  private final Span[] span;
   private final String coveredText;
-  SpanAnnotation(String id, String type, Span span, String coveredText) {
+  SpanAnnotation(String id, String type, Span[] span, String coveredText) {
     super(id, type);
-    this.span = span;
+    this.span = Arrays.copyOf(span, span.length);
+    Arrays.sort(this.span);
     this.coveredText = coveredText;
-  public Span getSpan() {
+  public Span[] getSpan() {
 Review comment:
   This should be renamed to getSpans

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> Brat format support fails on multi fragment annotations
> -------------------------------------------------------
>                 Key: OPENNLP-1193
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-1193
>             Project: OpenNLP
>          Issue Type: Bug
>          Components: Formats, Name Finder
>    Affects Versions: 1.8.4
>            Reporter: Joern Kottmann
>            Assignee: Joern Kottmann
>            Priority: Major
>             Fix For: 1.8.5
> The brat format support assumes that annotation with multiple fragments are 
> always appear next to each other, this assumption is false (and is only true 
> if there is a line break). If a single annotation is composed of multiple 
> fragments they should be outputted as multiple name spans as well.

This message was sent by Atlassian JIRA

Reply via email to