Package org.terrier.realtime.memory
Class MemoryLexiconEntry
- java.lang.Object
-
- org.terrier.structures.LexiconEntry
-
- org.terrier.realtime.memory.MemoryLexiconEntry
-
- All Implemented Interfaces:
java.io.Serializable,org.apache.hadoop.io.Writable,MemoryPointer,EntryStatistics,Pointer
- Direct Known Subclasses:
MemoryFieldsLexiconEntry
public class MemoryLexiconEntry extends LexiconEntry implements MemoryPointer, java.io.Serializable
A lexicon entry stored in a MemoryLexicon. Implements MemoryPointer such that it can be used to look up posting lists in a MemoryInvertedIndex.- Since:
- 4.0
- Author:
- Richard McCreadie, Stuart Mackie
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MemoryLexiconEntry()Constructor.MemoryLexiconEntry(int termid)Constructor (termid).MemoryLexiconEntry(int df, int tf)Constructor (df, tf).MemoryLexiconEntry(int termid, int df, int tf)Constructor (termid, df, tf).MemoryLexiconEntry(int termid, int df, int tf, int maxtf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(EntryStatistics es)Increment the statistics of this object by that of another.MemoryLexiconEntryclone()intgetDocumentFrequency()Return the number of documents that the term occurs in.intgetFrequency()Return the frequency (total number of occurrences) of the term.intgetMaxFrequencyInDocuments()Return the maximum in-document term frequency of the term among all documents the terms appears in.intgetNumberOfEntries()Pointer implementation: how many entries in the inverted index.intgetPointer()Get pointer value (termid).intgetTermId()Return the id of the term.java.lang.StringpointerToString()Returns a textual representation of the pointer alonevoidreadFields(java.io.DataInput arg0)Not implemented.voidsetDocumentFrequency(int nt)Set the number of documents that the term occurs in.voidsetFrequency(int F)Set the frequency (total number of occurrences) of the term.voidsetMaxFrequencyInDocuments(int max)Set the maximum in-document term frequency of the term among all documents the terms appears in.voidsetNumberOfEntries(int df)Update the number of entries in the pointervoidsetPointer(Pointer p)Update the pointervoidsetStatistics(int df, int tf)Update the document frequency and term frequencyvoidsetTermId(int termid)Set the term ID, the integer representation of the term in the index, e.g.voidsubtract(EntryStatistics es)Decrement the statistics of this object by that of another.voidwrite(java.io.DataOutput out)Not implemented.-
Methods inherited from class org.terrier.structures.LexiconEntry
equals, getWritableEntryStatistics, hashCode, toString
-
-
-
-
Constructor Detail
-
MemoryLexiconEntry
public MemoryLexiconEntry()
Constructor.
-
MemoryLexiconEntry
public MemoryLexiconEntry(int termid)
Constructor (termid).
-
MemoryLexiconEntry
public MemoryLexiconEntry(int df, int tf)Constructor (df, tf).
-
MemoryLexiconEntry
public MemoryLexiconEntry(int termid, int df, int tf)Constructor (termid, df, tf).
-
MemoryLexiconEntry
public MemoryLexiconEntry(int termid, int df, int tf, int maxtf)
-
-
Method Detail
-
getTermId
public int getTermId()
Return the id of the term.- Specified by:
getTermIdin interfaceEntryStatistics- Returns:
- the id of the term.
-
setTermId
public void setTermId(int termid)
Set the term ID, the integer representation of the term in the index, e.g. as used in direct index posting structures.- Specified by:
setTermIdin classLexiconEntry
-
getDocumentFrequency
public int getDocumentFrequency()
Return the number of documents that the term occurs in.- Specified by:
getDocumentFrequencyin interfaceEntryStatistics- Returns:
- the number of documents that the term occurs in.
-
getFrequency
public int getFrequency()
Return the frequency (total number of occurrences) of the term.- Specified by:
getFrequencyin interfaceEntryStatistics- Returns:
- the frequency (total number of occurrences) of the entry (term).
-
setStatistics
public void setStatistics(int df, int tf)Update the document frequency and term frequency- Specified by:
setStatisticsin classLexiconEntry
-
add
public void add(EntryStatistics es)
Increment the statistics of this object by that of another.- Specified by:
addin interfaceEntryStatistics- Parameters:
es- the other object whose statistics are used to increment the statistics of this object.
-
subtract
public void subtract(EntryStatistics es)
Decrement the statistics of this object by that of another.- Specified by:
subtractin interfaceEntryStatistics- Parameters:
es- the other object whose statistics are used to decrement the statistics of this object.
-
getNumberOfEntries
public int getNumberOfEntries()
Pointer implementation: how many entries in the inverted index. Usually the same as getDocumentFrequency().- Specified by:
getNumberOfEntriesin interfacePointer- Overrides:
getNumberOfEntriesin classLexiconEntry- Returns:
- the number of "things" that this pointer refers to.
-
setNumberOfEntries
public void setNumberOfEntries(int df)
Update the number of entries in the pointer- Specified by:
setNumberOfEntriesin interfacePointer- Overrides:
setNumberOfEntriesin classLexiconEntry- Parameters:
df- the number of "things" that the pointer refers to.
-
getPointer
public int getPointer()
Get pointer value (termid).- Specified by:
getPointerin interfaceMemoryPointer
-
setPointer
public void setPointer(Pointer p)
Update the pointer- Specified by:
setPointerin interfacePointer- Overrides:
setPointerin classLexiconEntry- Parameters:
p- other pointer to update the pointer in this object.
-
pointerToString
public java.lang.String pointerToString()
Returns a textual representation of the pointer alone- Specified by:
pointerToStringin interfacePointer- Overrides:
pointerToStringin classLexiconEntry
-
getMaxFrequencyInDocuments
public int getMaxFrequencyInDocuments()
Description copied from interface:EntryStatisticsReturn the maximum in-document term frequency of the term among all documents the terms appears in.- Specified by:
getMaxFrequencyInDocumentsin interfaceEntryStatistics- Returns:
- the maximum in-document term frequency of the term among all documents the terms appears in.
-
setMaxFrequencyInDocuments
public void setMaxFrequencyInDocuments(int max)
Description copied from interface:EntryStatisticsSet the maximum in-document term frequency of the term among all documents the terms appears in.- Specified by:
setMaxFrequencyInDocumentsin interfaceEntryStatistics- Parameters:
max- the maximum in-document term frequency of the term among all documents the terms appears in.
-
readFields
public void readFields(java.io.DataInput arg0) throws java.io.IOExceptionNot implemented.- Specified by:
readFieldsin interfaceorg.apache.hadoop.io.Writable- Throws:
java.io.IOException
-
write
public void write(java.io.DataOutput out) throws java.io.IOExceptionNot implemented.- Specified by:
writein interfaceorg.apache.hadoop.io.Writable- Throws:
java.io.IOException
-
clone
public MemoryLexiconEntry clone()
- Overrides:
clonein classjava.lang.Object
-
setFrequency
public void setFrequency(int F)
Description copied from interface:EntryStatisticsSet the frequency (total number of occurrences) of the term.- Specified by:
setFrequencyin interfaceEntryStatistics- Parameters:
F- the frequency (total number of occurrences) of the entry (term).
-
setDocumentFrequency
public void setDocumentFrequency(int nt)
Description copied from interface:EntryStatisticsSet the number of documents that the term occurs in.- Specified by:
setDocumentFrequencyin interfaceEntryStatistics- Parameters:
nt- the number of documents that the term occurs in.
-
-