Package it.unimi.dsi.mg4j.search.visitor

Examples of it.unimi.dsi.mg4j.search.visitor.TermCollectionVisitor


   * @param termMap a map from terms to positions in <code>frequencies</code>, or <code>null</code> if <code>frequencies</code> is <code>null</code>.
   * @param frequencies the frequencies, or <code>null</code> for Boldi's variant.
   */
  public BM25FScorer( final double k1, final Reference2DoubleMap<Index> b, final StringMap<? extends CharSequence> termMap, final LongList frequencies ) {
    this.termMap = termMap;
    termVisitor = new TermCollectionVisitor();
    setupVisitor = new CounterSetupVisitor( termVisitor );
    counterCollectionVisitor = new CounterCollectionVisitor( setupVisitor );
    this.k1 = k1;
    this.bByIndex = b;
    this.frequencies = frequencies;
View Full Code Here


   * @param frequencies the frequencies, or <code>null</code> for Boldi's variant.
   * @param b the <var>b</var> parameter, specified as a map from indices to values.
   */
  public BM25FScorer( final double k1, final StringMap<? extends CharSequence> termMap, final LongList frequencies, final Object2DoubleMap<String> b ) {
    this.termMap = termMap;
    termVisitor = new TermCollectionVisitor();
    setupVisitor = new CounterSetupVisitor( termVisitor );
    counterCollectionVisitor = new CounterCollectionVisitor( setupVisitor );
    this.k1 = k1;
    this.bByName = b;
    this.frequencies = frequencies;
View Full Code Here

  private final CounterSetupVisitor counterSetupVisitor;
  /** The term collection visitor used to estimate counts. */
  private final TermCollectionVisitor termCollectionVisitor;
 
  public CountScorer() {
    termCollectionVisitor = new TermCollectionVisitor();
    counterSetupVisitor = new CounterSetupVisitor( termCollectionVisitor );
    counterCollectionVisitor = new CounterCollectionVisitor( counterSetupVisitor );
  }
View Full Code Here

  /** Creates a BM25 scorer using specified <var>k</var><sub>1</sub> and <var>b</var> parameters.
   * @param k1 the <var>k</var><sub>1</sub> parameter.
   * @param b the <var>b</var> parameter.
   */
  public BM25Scorer( final double k1, final double b ) {
    termVisitor = new TermCollectionVisitor();
    setupVisitor = new CounterSetupVisitor( termVisitor );
    counterCollectionVisitor = new CounterCollectionVisitor( setupVisitor );
    this.k1 = k1;
    this.b = b;
    k1Plus1 = k1 + 1;
View Full Code Here

  private int[] size;
  /** An array indexed by offsets that caches the inverse document-frequency part of the formula, multiplied by the index weight. */
  private double[] weightedIdfPart;
 
  public TfIdfScorer() {
    termVisitor = new TermCollectionVisitor();
    setupVisitor = new CounterSetupVisitor( termVisitor );
    counterCollectionVisitor = new CounterCollectionVisitor( setupVisitor );
  }
View Full Code Here

  }

 
  public void testCounterSetup() throws Exception {

    TermCollectionVisitor termVisitor = new TermCollectionVisitor();
    CounterSetupVisitor setupVisitor = new CounterSetupVisitor( termVisitor );
    CounterCollectionVisitor counterCollectionVisitor = new CounterCollectionVisitor( setupVisitor );

    it.unimi.dsi.mg4j.query.nodes.Query query = simpleParser.parse( "this" );
    DocumentIteratorBuilderVisitor documentIteratorBuilderVisitor = new DocumentIteratorBuilderVisitor( null, index0, Integer.MAX_VALUE );

    DocumentIterator indexIterator = query.accept( documentIteratorBuilderVisitor );

    indexIterator.nextDocument();

    termVisitor.prepare();
    indexIterator.accept( termVisitor );
    setupVisitor.prepare();
    indexIterator.accept( setupVisitor );

    // assertEquals( 3, indexIterator.frequency() );
View Full Code Here

TOP

Related Classes of it.unimi.dsi.mg4j.search.visitor.TermCollectionVisitor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.