Package it.unimi.dsi.util

Examples of it.unimi.dsi.util.Interval


      for( int i = frontSize; i-- != 0; ) terms.add( indexIterator[ positionFront[ i ] ].termNumber() );
    }
   
    public Interval nextInterval() {
      if ( next != null ) {
        final Interval result = next;
        next = null;
        return result;
      }
     
      if ( positionQueue.isEmpty() ) return null;
View Full Code Here


  public double score( final Index index ) throws IOException {
    final IntervalIterator it = documentIterator.intervalIterator( index );
    if ( it == IntervalIterators.TRUE || it == IntervalIterators.FALSE ) return 0;
    double score = 0, residual = 1, t;
    int extent = it.extent(), length;
    Interval interval;
    while ( ( interval = it.nextInterval() ) != null ) {
      length = interval.length();
      t = residual * Math.min( (double)extent / length, 1 ) / 2;
      residual -= t;
      score += t;
      if ( score > .99 ) return 1;
    }
View Full Code Here

  public double score( final Index index ) throws IOException {
    final IntervalIterator it = documentIterator.intervalIterator( index );
    if ( it == IntervalIterators.TRUE || it == IntervalIterators.FALSE ) return 0;
    double result = 0;
    int lt, count = 0;
    Interval interval;
    while ( ( interval = it.nextInterval() ) != null ) {
      count++;
      lt = interval.length();
      if ( lt < h ) result += 1;
      else result += Math.pow( h / (double) lt, alpha );
    }
    return normalize? result / count : result;
  }
View Full Code Here

    /* We reset the interval set, add the sentinels and the (certainly existing) first interval.
     * If the first interval is too long, we shorten it. */
    leftOrderedIntervals.add( INIT[ 0 ] );
    leftOrderedIntervals.add( INIT[ 1 ] );

    Interval interval;
    interval = shortIntervals.dequeue();
    if ( interval.length() < intervalMaxLength ) leftOrderedIntervals.add( new SelectedInterval( interval, IntervalType.WHOLE ) );
    else {
      leftOrderedIntervals.add( new SelectedInterval( Interval.valueOf( interval.left, interval.left + intervalMaxLength / 2 ), IntervalType.PREFIX ) );
      leftOrderedIntervals.add( new SelectedInterval( Interval.valueOf( interval.right - intervalMaxLength / 2, interval.right ), IntervalType.SUFFIX ) );
    }

    /* We now iteratively extract intervals from the queue, check that they do not overlap
     * any interval already chosen, and in case add it to the set of chosen intervals. */
    //System.err.println( "Starting with " + shortIntervals.size() + " intervals");
   
    ObjectBidirectionalIterator<SelectedInterval> iterator;
    SelectedInterval left, right;
    while( leftOrderedIntervals.size() - INIT.length < maxIntervals && ! shortIntervals.isEmpty() ) {
      //System.err.println( "Map is now: " + leftOrderedIntervals );
      interval = shortIntervals.dequeue();
      // If all remaining intervals are too large, stop iteration.
      if ( interval.length() > intervalMaxLength ) break;
     
      // This iterator falls exactly in the middle of the intervals preceding and following interval.
      iterator = leftOrderedIntervals.iterator( new SelectedInterval( interval, null ) );
      iterator.previous();
      left = iterator.next();
View Full Code Here

TOP

Related Classes of it.unimi.dsi.util.Interval

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.