Package org.terrier.structures
Class LexiconOutputStream<KEY>
- java.lang.Object
-
- org.terrier.structures.LexiconOutputStream<KEY>
-
- Type Parameters:
KEY-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
FSOMapFileLexiconOutputStreamGeneric
public abstract class LexiconOutputStream<KEY> extends java.lang.Object implements java.io.CloseableThis class implements an output stream for the lexicon structure.- Author:
- Vassilis Plachouras & Craig Macdonald
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.DataOutputlexiconStreamA data input stream to read from the bufferInput.protected longnumPointersWrittenPointer written - the sum of the Ntsprotected intnumTermsWrittenprotected longnumTokensWrittencollection length - the sum of the TFs
-
Constructor Summary
Constructors Modifier Constructor Description protectedLexiconOutputStream()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the lexicon stream.longgetNumberOfPointersWritten()Returns the number of pointers there would be in an inverted index built using this lexicon (thus far).intgetNumberOfTermsWritten()Returns the number of terms written so far by this LexiconOutputStreamlonggetNumberOfTokensWritten()Returns the number of tokens there are in the entire collection represented by this lexicon (thus far).protected voidincrementCounters(EntryStatistics t)abstract intwriteNextEntry(KEY _key, LexiconEntry _value)Writes a lexicon entry.
-
-
-
Field Detail
-
lexiconStream
protected java.io.DataOutput lexiconStream
A data input stream to read from the bufferInput.
-
numPointersWritten
protected long numPointersWritten
Pointer written - the sum of the Nts
-
numTokensWritten
protected long numTokensWritten
collection length - the sum of the TFs
-
numTermsWritten
protected int numTermsWritten
-
-
Method Detail
-
close
public void close()
Closes the lexicon stream. IOException if an I/O error occurs while closing the stream.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
writeNextEntry
public abstract int writeNextEntry(KEY _key, LexiconEntry _value) throws java.io.IOException
Writes a lexicon entry.- Parameters:
_key- the key - usually the term_value- the lexicon entry value- Returns:
- the number of bytes written to the file.
- Throws:
java.io.IOException- if an I/O error occurs
-
incrementCounters
protected void incrementCounters(EntryStatistics t)
-
getNumberOfPointersWritten
public long getNumberOfPointersWritten()
Returns the number of pointers there would be in an inverted index built using this lexicon (thus far). This is equal to the sum of the Nts written to this lexicon output stream.
-
getNumberOfTokensWritten
public long getNumberOfTokensWritten()
Returns the number of tokens there are in the entire collection represented by this lexicon (thus far). This is equal to the sum of the TFs written to this lexicon output stream.
-
getNumberOfTermsWritten
public int getNumberOfTermsWritten()
Returns the number of terms written so far by this LexiconOutputStream
-
-