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 void
add(EntryStatistics es)
Increment the statistics of this object by that of another.MemoryLexiconEntry
clone()
int
getDocumentFrequency()
Return the number of documents that the term occurs in.int
getFrequency()
Return the frequency (total number of occurrences) of the term.int
getMaxFrequencyInDocuments()
Return the maximum in-document term frequency of the term among all documents the terms appears in.int
getNumberOfEntries()
Pointer implementation: how many entries in the inverted index.int
getPointer()
Get pointer value (termid).int
getTermId()
Return the id of the term.java.lang.String
pointerToString()
Returns a textual representation of the pointer alonevoid
readFields(java.io.DataInput arg0)
Not implemented.void
setDocumentFrequency(int nt)
Set the number of documents that the term occurs in.void
setFrequency(int F)
Set the frequency (total number of occurrences) of the term.void
setMaxFrequencyInDocuments(int max)
Set the maximum in-document term frequency of the term among all documents the terms appears in.void
setNumberOfEntries(int df)
Update the number of entries in the pointervoid
setPointer(Pointer p)
Update the pointervoid
setStatistics(int df, int tf)
Update the document frequency and term frequencyvoid
setTermId(int termid)
Set the term ID, the integer representation of the term in the index, e.g.void
subtract(EntryStatistics es)
Decrement the statistics of this object by that of another.void
write(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:
getTermId
in 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:
setTermId
in classLexiconEntry
-
getDocumentFrequency
public int getDocumentFrequency()
Return the number of documents that the term occurs in.- Specified by:
getDocumentFrequency
in 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:
getFrequency
in 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:
setStatistics
in classLexiconEntry
-
add
public void add(EntryStatistics es)
Increment the statistics of this object by that of another.- Specified by:
add
in 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:
subtract
in 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:
getNumberOfEntries
in interfacePointer
- Overrides:
getNumberOfEntries
in 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:
setNumberOfEntries
in interfacePointer
- Overrides:
setNumberOfEntries
in classLexiconEntry
- Parameters:
df
- the number of "things" that the pointer refers to.
-
getPointer
public int getPointer()
Get pointer value (termid).- Specified by:
getPointer
in interfaceMemoryPointer
-
setPointer
public void setPointer(Pointer p)
Update the pointer- Specified by:
setPointer
in interfacePointer
- Overrides:
setPointer
in 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:
pointerToString
in interfacePointer
- Overrides:
pointerToString
in classLexiconEntry
-
getMaxFrequencyInDocuments
public int getMaxFrequencyInDocuments()
Description copied from interface:EntryStatistics
Return the maximum in-document term frequency of the term among all documents the terms appears in.- Specified by:
getMaxFrequencyInDocuments
in 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:EntryStatistics
Set the maximum in-document term frequency of the term among all documents the terms appears in.- Specified by:
setMaxFrequencyInDocuments
in 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.IOException
Not implemented.- Specified by:
readFields
in interfaceorg.apache.hadoop.io.Writable
- Throws:
java.io.IOException
-
write
public void write(java.io.DataOutput out) throws java.io.IOException
Not implemented.- Specified by:
write
in interfaceorg.apache.hadoop.io.Writable
- Throws:
java.io.IOException
-
clone
public MemoryLexiconEntry clone()
- Overrides:
clone
in classjava.lang.Object
-
setFrequency
public void setFrequency(int F)
Description copied from interface:EntryStatistics
Set the frequency (total number of occurrences) of the term.- Specified by:
setFrequency
in interfaceEntryStatistics
- Parameters:
F
- the frequency (total number of occurrences) of the entry (term).
-
setDocumentFrequency
public void setDocumentFrequency(int nt)
Description copied from interface:EntryStatistics
Set the number of documents that the term occurs in.- Specified by:
setDocumentFrequency
in interfaceEntryStatistics
- Parameters:
nt
- the number of documents that the term occurs in.
-
-