kylm.reader
Class TextFileSentenceReader

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

public class TextFileSentenceReader
extends java.lang.Object
implements SentenceReader

Implementation of a loader that loads from a text file

Author:
neubig

Constructor Summary
TextFileSentenceReader(java.lang.String fileName)
          The constructor, saves the file and uses a single space as the default divider
TextFileSentenceReader(java.lang.String fileName, java.lang.String divider)
          The constructor, saves the file name 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

TextFileSentenceReader

public TextFileSentenceReader(java.lang.String fileName)
                       throws java.io.IOException
The constructor, saves the file and uses a single space as the default divider

Parameters:
fileName - The name of the file to be opened
Throws:
java.io.IOException - if the file doesn't exist or is unreadable

TextFileSentenceReader

public TextFileSentenceReader(java.lang.String fileName,
                              java.lang.String divider)
                       throws java.io.IOException
The constructor, saves the file name and uses the passed in divider

Parameters:
fileName - The name of the file to be opened
divider - A regular expression that is used to divide strings in the corpus
Throws:
java.io.IOException - if the file doesn't exist or is unreadable
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.