|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ir.vsr.DocumentIterator
public class DocumentIterator
An object for iterating over a set of documents in a directory. Produces DocumentFile objects that are either TextFileDocuments or HTMFileDocuments depending on whether docType is TYPE_TEXT or TYPE_HTML
Field Summary | |
---|---|
protected short |
docType
The type of documents to be created |
protected java.io.File[] |
files
An array of files in the directory |
protected int |
position
The current position of the iterator in this array |
protected boolean |
stem
Whether tokens should be stemmed with Porter stemmer |
static short |
TYPE_HTML
docType for HTML files |
static short |
TYPE_TEXT
docType for ASCII text files |
Constructor Summary | |
---|---|
DocumentIterator(java.io.File dirFile)
Create an iterator for TexFileDocuments |
|
DocumentIterator(java.io.File dirFile,
short docType,
boolean stem)
Create an iterator with these attributes |
|
DocumentIterator(java.io.File dirFile,
short docType,
boolean stem,
java.io.FilenameFilter filter)
Create an iterator with these attributes |
Method Summary | |
---|---|
boolean |
hasMoreDocuments()
Returns true iff there are more documents in this directory |
static void |
main(java.lang.String[] args)
Test by printing the bag-of-words for each file in the given directory |
FileDocument |
nextDocument()
Get the next document |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final short TYPE_TEXT
public static final short TYPE_HTML
protected java.io.File[] files
protected int position
protected short docType
protected boolean stem
Constructor Detail |
---|
public DocumentIterator(java.io.File dirFile, short docType, boolean stem, java.io.FilenameFilter filter)
dirFile
- The directory to use as a source of documents.docType
- The type of Document to create. e.g. TYPE_TEXT or TYPE_HTMLstem
- Whether tokens should be stemmed with Porter stemmer.filter
- A filter to select a subset of the docs in the directorypublic DocumentIterator(java.io.File dirFile, short docType, boolean stem)
dirFile
- The directory to use as a source of documents.docType
- The type of Document to create. e.g. TYPE_TEXT or TYPE_HTMLstem
- Whether tokens should be stemmed with Porter stemmer.public DocumentIterator(java.io.File dirFile)
dirFile
- The directory to use as a source of documents.Method Detail |
---|
public FileDocument nextDocument()
public boolean hasMoreDocuments()
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |