Package org.terrier.structures
Class SimpleNgramEntryStatistics
- java.lang.Object
-
- org.terrier.structures.SimpleNgramEntryStatistics
-
- All Implemented Interfaces:
java.io.Serializable,org.apache.hadoop.io.Writable,EntryStatistics,NgramEntryStatistics
public class SimpleNgramEntryStatistics extends java.lang.Object implements NgramEntryStatistics, org.apache.hadoop.io.Writable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleNgramEntryStatistics()SimpleNgramEntryStatistics(int ws)SimpleNgramEntryStatistics(EntryStatistics e)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(EntryStatistics e)Increment the statistics of this object by that of another.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.intgetTermId()Return the id of the term.intgetWindowSize()Get the size of the window used to calculate an n-gram frequencyEntryStatisticsgetWritableEntryStatistics()Copy this entry statistics to one that can be reused.voidreadFields(java.io.DataInput in)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.voidsetWindowSize(int ws)Update the window sizevoidsubtract(EntryStatistics e)Decrement the statistics of this object by that of another.java.lang.StringtoString()voidwrite(java.io.DataOutput out)
-
-
-
Constructor Detail
-
SimpleNgramEntryStatistics
public SimpleNgramEntryStatistics(EntryStatistics e)
-
SimpleNgramEntryStatistics
public SimpleNgramEntryStatistics()
-
SimpleNgramEntryStatistics
public SimpleNgramEntryStatistics(int ws)
-
-
Method Detail
-
getFrequency
public int getFrequency()
Description copied from interface:EntryStatisticsReturn the frequency (total number of occurrences) of the term.- Specified by:
getFrequencyin interfaceEntryStatistics- Returns:
- the frequency (total number of occurrences) of the entry (term).
-
getDocumentFrequency
public int getDocumentFrequency()
Description copied from interface:EntryStatisticsReturn the number of documents that the term occurs in.- Specified by:
getDocumentFrequencyin interfaceEntryStatistics- Returns:
- the number of documents that the term occurs in.
-
getTermId
public int getTermId()
Description copied from interface:EntryStatisticsReturn the id of the term.- Specified by:
getTermIdin interfaceEntryStatistics- Returns:
- the id of the term.
-
add
public void add(EntryStatistics e)
Description copied from interface:EntryStatisticsIncrement the statistics of this object by that of another.- Specified by:
addin interfaceEntryStatistics- Parameters:
e- the other object whose statistics are used to increment the statistics of this object.
-
subtract
public void subtract(EntryStatistics e)
Description copied from interface:EntryStatisticsDecrement the statistics of this object by that of another.- Specified by:
subtractin interfaceEntryStatistics- Parameters:
e- the other object whose statistics are used to decrement the statistics of this object.
-
getWritableEntryStatistics
public EntryStatistics getWritableEntryStatistics()
Description copied from interface:EntryStatisticsCopy this entry statistics to one that can be reused. Kind of like a clone.- Specified by:
getWritableEntryStatisticsin interfaceEntryStatistics- Returns:
- an identical entry statistics, but which can be reused.
-
getWindowSize
public int getWindowSize()
Description copied from interface:NgramEntryStatisticsGet the size of the window used to calculate an n-gram frequency- Specified by:
getWindowSizein interfaceNgramEntryStatistics- Returns:
- number of tokens
-
setWindowSize
public void setWindowSize(int ws)
Description copied from interface:NgramEntryStatisticsUpdate the window size- Specified by:
setWindowSizein interfaceNgramEntryStatistics
-
readFields
public void readFields(java.io.DataInput in) throws java.io.IOException- Specified by:
readFieldsin interfaceorg.apache.hadoop.io.Writable- Throws:
java.io.IOException
-
write
public void write(java.io.DataOutput out) throws java.io.IOException- Specified by:
writein interfaceorg.apache.hadoop.io.Writable- Throws:
java.io.IOException
-
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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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.
-
-