Class VSMSearchEngine
java.lang.Object
es.uam.eps.ir.relison.content.search.AbstractSearchEngine
es.uam.eps.ir.relison.content.search.VSMSearchEngine
- All Implemented Interfaces:
SearchEngine
public class VSMSearchEngine extends AbstractSearchEngine
Search engine using the vector space model.
-
Field Summary
Fields Modifier and Type Field Description (package private) it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMapmodsModules -
Constructor Summary
Constructors Constructor Description VSMSearchEngine(Index<?> index)Constructor.VSMSearchEngine(Index<?> index, java.lang.String modules)Constructor. -
Method Summary
Modifier and Type Method Description java.util.Map<java.lang.Integer,java.lang.Double>search(FreqVector vector)Searches from a term frequency vector.java.util.Map<java.lang.Integer,java.lang.Double>search(java.lang.String query)Searches from a query.static doubletfidf(double freq, double df, double numDocs)Computes the tf-idf of the value.
-
Field Details
-
mods
it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap modsModules
-
-
Constructor Details
-
VSMSearchEngine
Constructor.- Parameters:
index- index.
-
VSMSearchEngine
Constructor.- Parameters:
index- index.modules- a file containing the precomputed modules.
-
-
Method Details
-
tfidf
public static double tfidf(double freq, double df, double numDocs)Computes the tf-idf of the value.- Parameters:
freq- frequency of the term.df- number of documents containing the term.numDocs- total number of documents- Returns:
- the tf-idf value of the
-
search
public java.util.Map<java.lang.Integer,java.lang.Double> search(FreqVector vector) throws java.io.IOExceptionDescription copied from interface:SearchEngineSearches from a term frequency vector.- Parameters:
vector- the term frequency vector.- Returns:
- a map containing the results of the search.
- Throws:
java.io.IOException- if something fails while searching.
-
search
public java.util.Map<java.lang.Integer,java.lang.Double> search(java.lang.String query) throws java.io.IOExceptionDescription copied from interface:SearchEngineSearches from a query.- Parameters:
query- the query.- Returns:
- a map containing the results of the search.
- Throws:
java.io.IOException- if something fails while searching.
-