You are here

protected static function SuggestionHelper::getDelta in Autocomplete Search Suggestions 7

Estimate the performance.

Parameters

float $delta: The current performance remainder.

int $n: The summation N - 1.

Return value

float The suggestion's remainder summation.

1 call to SuggestionHelper::getDelta()
SuggestionHelper::calculateDensity in src/SuggestionHelper.php
Calculate the ngram's density.

File

src/SuggestionHelper.php, line 340
Helper methods for the suggestion module.

Class

SuggestionHelper
Provides helper methods for suggestions.

Code

protected static function getDelta($delta, $n) {
  if ($delta < self::MIN_DELTA || !$n) {
    return 0;
  }
  $x = pow($delta, self::EXP);
  return $x + self::getDelta($delta - $x, $n - 1);
}