Class WrapperIndividualForwardContentIndex<C,U>
java.lang.Object
es.uam.eps.ir.relison.content.index.AbstractIndex<C>
es.uam.eps.ir.relison.content.index.individual.AbstractIndividualContentIndex<C,U>
es.uam.eps.ir.relison.content.index.individual.WrapperIndividualForwardContentIndex<C,U>
- Type Parameters:
C
- type of the contents.U
- type of the users.
- All Implemented Interfaces:
DocumentMap<C>
,ForwardIndex<C>
,Index<C>
,IndividualContentIndex<C,U>
public class WrapperIndividualForwardContentIndex<C,U> extends AbstractIndividualContentIndex<C,U> implements ForwardIndex<C>
Individual content index builder wrapping a simple one.
-
Field Summary
Fields Modifier and Type Field Description private ForwardIndex<C>
index
The internal index.Fields inherited from class es.uam.eps.ir.relison.content.index.individual.AbstractIndividualContentIndex
contentsToUsers, usersToContents
-
Constructor Summary
Constructors Constructor Description WrapperIndividualForwardContentIndex(ForwardIndex<C> index, it.unimi.dsi.fastutil.ints.Int2ObjectMap<U> userMap)
Constructor.WrapperIndividualForwardContentIndex(java.lang.String indexFolder, ForwardIndex<C> index, org.ranksys.formats.parsing.Parser<U> uParser)
Constructor. -
Method Summary
Modifier and Type Method Description java.util.Collection<java.lang.String>
getAllTerms()
Obtains the set of all terms in the index dictionary.FreqVector
getContentVector(int contentId)
Obtains a user vector.long
getDocFreq(java.lang.String term)
Obtains the number of documents containing the term.PostingsList
getPostings(java.lang.String term)
Obtains the posting list of a term.long
getTermFreq(java.lang.String term, int contentId)
Obtains the term frequency of a term in a user vector.long
getTotalFreq(java.lang.String term)
Obtains the total frequency of a term in the collection.int
numDocs()
Obtains the number of contents.Methods inherited from class es.uam.eps.ir.relison.content.index.individual.AbstractIndividualContentIndex
getContents, getUser, loadUserContentMap
Methods inherited from class es.uam.eps.ir.relison.content.index.AbstractIndex
getContent, getContentId, loadContents
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface es.uam.eps.ir.relison.content.index.DocumentMap
getContent, getContentId
-
Field Details
-
index
The internal index.
-
-
Constructor Details
-
WrapperIndividualForwardContentIndex
public WrapperIndividualForwardContentIndex(java.lang.String indexFolder, ForwardIndex<C> index, org.ranksys.formats.parsing.Parser<U> uParser) throws java.io.IOExceptionConstructor.- Parameters:
indexFolder
- route to the index.index
- the index.uParser
- a user parser.- Throws:
java.io.IOException
- if something fails while loading the content to user map.
-
WrapperIndividualForwardContentIndex
public WrapperIndividualForwardContentIndex(ForwardIndex<C> index, it.unimi.dsi.fastutil.ints.Int2ObjectMap<U> userMap)Constructor.- Parameters:
index
- the index.userMap
- the content to user map.
-
-
Method Details
-
getPostings
Description copied from interface:Index
Obtains the posting list of a term.- Specified by:
getPostings
in interfaceIndex<C>
- Parameters:
term
- the term to look up.- Returns:
- the posting list of the term.
- Throws:
java.io.IOException
- if something fails while reading the posting list.
-
getAllTerms
public java.util.Collection<java.lang.String> getAllTerms() throws java.io.IOExceptionDescription copied from interface:Index
Obtains the set of all terms in the index dictionary.- Specified by:
getAllTerms
in interfaceIndex<C>
- Returns:
- the collection of terms.
- Throws:
java.io.IOException
- if something fails while reading the list of terms.
-
getTotalFreq
public long getTotalFreq(java.lang.String term) throws java.io.IOExceptionDescription copied from interface:Index
Obtains the total frequency of a term in the collection.- Specified by:
getTotalFreq
in interfaceIndex<C>
- Parameters:
term
- the term to look up.- Returns:
- the total frequency of the term in the collection.
- Throws:
java.io.IOException
- if something fails while reading the frequency.
-
getDocFreq
public long getDocFreq(java.lang.String term) throws java.io.IOExceptionDescription copied from interface:Index
Obtains the number of documents containing the term.- Specified by:
getDocFreq
in interfaceIndex<C>
- Parameters:
term
- the term to look up.- Returns:
- the number of documents containing the term.
- Throws:
java.io.IOException
- if something fails while reading the doc frequency.
-
numDocs
public int numDocs()Description copied from interface:DocumentMap
Obtains the number of contents.- Specified by:
numDocs
in interfaceDocumentMap<C>
- Returns:
- the number of contents.
-
getContentVector
Description copied from interface:ForwardIndex
Obtains a user vector.- Specified by:
getContentVector
in interfaceForwardIndex<C>
- Parameters:
contentId
- identifier of the content in the index.- Returns:
- a frequency vector for the corresponding content.
- Throws:
java.io.IOException
- if something fails while reading the index.
-
getTermFreq
public long getTermFreq(java.lang.String term, int contentId) throws java.io.IOExceptionDescription copied from interface:ForwardIndex
Obtains the term frequency of a term in a user vector.- Specified by:
getTermFreq
in interfaceForwardIndex<C>
- Parameters:
term
- the term to look up.contentId
- the content identifier- Returns:
- the frequency of the term in the content vector
- Throws:
java.io.IOException
- if something fails while reading the value.
-