Class Span


  • public class Span
    extends Annotated
    A sequence of tokens in a Document
    Since:
    5.2
    Version:
    5.2
    Author:
    Pedro Oliveira
    • Constructor Summary

      Constructors 
      Constructor Description
      Span​(Document theDocument, int theSentence, int theBegin, int theEnd)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      Token first()
      First token
      int hashCode()  
      Token last()
      Last token
      int size()
      Number of tokens
      Span subspan​(int theBegin, int theEnd)
      Returns a Span that is a subspan of this one
      java.lang.String text()
      Tokens in the span as a space separated string
      java.lang.String text​(java.lang.String theDelimiter)
      Tokens in the span as a delimiter separated string
      Token token​(int theIndex)
      Token at index
      Token[] tokens()
      The tokens as an array
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Span

        public Span​(Document theDocument,
                    int theSentence,
                    int theBegin,
                    int theEnd)
    • Method Detail

      • subspan

        public Span subspan​(int theBegin,
                            int theEnd)
        Returns a Span that is a subspan of this one
      • tokens

        public Token[] tokens()
        The tokens as an array
      • token

        public Token token​(int theIndex)
        Token at index
      • first

        public Token first()
        First token
      • last

        public Token last()
        Last token
      • size

        public int size()
        Number of tokens
      • text

        public java.lang.String text()
        Tokens in the span as a space separated string
      • text

        public java.lang.String text​(java.lang.String theDelimiter)
        Tokens in the span as a delimiter separated string
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Annotated
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object