se.lth.cs.nlp.nlputils.annotations
Class AnnotationLayer

java.lang.Object
  extended by se.lth.cs.nlp.nlputils.annotations.AnnotationLayer

public class AnnotationLayer
extends Object

Annotation layer.

Author:
Richard Johansson (richard@cs.lth.se)

Field Summary
 String label
           
 ArrayList<Span> spans
           
 
Constructor Summary
AnnotationLayer()
           
 
Method Summary
 CompareResult compare(AnnotationLayer other)
          Compares this layer to another layer.
 void findCharIndices(String[] tokens)
          Sets the character indices for all spans, assuming that the token indices are already set.
 void findTokenIndices(String[] tokens)
          Sets the token indices for all spans, assuming that the character indices are already set.
 void printDetailed(String text)
          Detailed printout.
 ArrayList<Span> removeEmptySpans()
          Removes all empty spans from the layer.
(package private)  String toColoredHTML(String text)
          Returns an HTML representation of the layer.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

label

public String label

spans

public ArrayList<Span> spans
Constructor Detail

AnnotationLayer

public AnnotationLayer()
Method Detail

compare

public CompareResult compare(AnnotationLayer other)
Compares this layer to another layer. TODO: this method has quadratic complexity.

Parameters:
other - the layer to compare with.
Returns:
the result of the comparison.

toString

public String toString()
Overrides:
toString in class Object

printDetailed

public void printDetailed(String text)
Detailed printout.

Parameters:
text -

removeEmptySpans

public ArrayList<Span> removeEmptySpans()
Removes all empty spans from the layer.

Returns:
the removed spans.

findTokenIndices

public void findTokenIndices(String[] tokens)
Sets the token indices for all spans, assuming that the character indices are already set.

Parameters:
tokens - the tokens the indices refer to.

findCharIndices

public void findCharIndices(String[] tokens)
Sets the character indices for all spans, assuming that the token indices are already set.

Parameters:
tokens - the tokens the indices refer to.

toColoredHTML

String toColoredHTML(String text)
Returns an HTML representation of the layer.

Parameters:
text - the text.
Returns:
the HTML string.