mark.nlp.data
Class TokenInstance

java.lang.Object
  |
  +--mark.nlp.data.Instance
        |
        +--mark.nlp.data.TokenInstance

public class TokenInstance
extends Instance

An instance that contains tokens. The class follows the Immutable design pattern.


Constructor Summary
TokenInstance(TextInstance text, java.lang.String scannerName)
          Initializes the token instance.
 
Method Summary
 java.lang.String get(int i)
          Returns the i'th token.
 int size()
          Returns the number of tokens in the instance.
 
Methods inherited from class mark.nlp.data.Instance
category, setCategory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenInstance

public TokenInstance(TextInstance text,
                     java.lang.String scannerName)
              throws java.lang.Exception
Initializes the token instance.

Parameters:
text - the text from which to extract tokens.
scannerName - the name of the scanner to use to tokenize the text.
Method Detail

size

public int size()
Returns the number of tokens in the instance.

Returns:
the number of tokens.

get

public java.lang.String get(int i)
Returns the i'th token.

Parameters:
i - specifies the token to return. Should be in the range 0..size () - 1.
Returns:
the i'th token.