kylm.reader
Class TextArraySentenceReader

java.lang.Object
  extended by kylm.reader.TextArraySentenceReader
All Implemented Interfaces:
java.lang.Iterable<java.lang.String[]>, SentenceReader

public class TextArraySentenceReader
extends java.lang.Object
implements SentenceReader

Implementation of a loader that loads directly from a text array in memory

Author:
neubig

Constructor Summary
TextArraySentenceReader(java.lang.String[] sents)
          The constructor, saves the sentence array and uses a single space as the default divider
TextArraySentenceReader(java.lang.String[] sents, java.lang.String divider)
          The constructor, saves the sentence array and uses the passed in divider
 
Method Summary
 java.util.Iterator<java.lang.String[]> iterator()
           
 boolean supportsReset()
          Whether the sentence loader supports returning multiple iterators or not.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextArraySentenceReader

public TextArraySentenceReader(java.lang.String[] sents)
The constructor, saves the sentence array and uses a single space as the default divider

Parameters:
sents - the sentence array

TextArraySentenceReader

public TextArraySentenceReader(java.lang.String[] sents,
                               java.lang.String divider)
The constructor, saves the sentence array and uses the passed in divider

Parameters:
sents - the sentence arrays
Method Detail

iterator

public java.util.Iterator<java.lang.String[]> iterator()
Specified by:
iterator in interface java.lang.Iterable<java.lang.String[]>
Specified by:
iterator in interface SentenceReader

supportsReset

public boolean supportsReset()
Description copied from interface: SentenceReader
Whether the sentence loader supports returning multiple iterators or not. If multiple iterators are not supported, input can only be read once.

Specified by:
supportsReset in interface SentenceReader
Returns:
Whether multiple iterators can be returned.