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.Int2DoubleOpenHashMap mods
    Modules

    Fields inherited from class es.uam.eps.ir.relison.content.search.AbstractSearchEngine

    contentIndex
  • 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 double tfidf​(double freq, double df, double numDocs)
    Computes the tf-idf of the value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • mods

      it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap mods
      Modules
  • Constructor Details

    • VSMSearchEngine

      public VSMSearchEngine​(Index<?> index)
      Constructor.
      Parameters:
      index - index.
    • VSMSearchEngine

      public VSMSearchEngine​(Index<?> index, java.lang.String modules)
      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.IOException
      Description copied from interface: SearchEngine
      Searches 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.IOException
      Description copied from interface: SearchEngine
      Searches 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.