Function __global->_smart_grammar_says_continue

Definitions

sources/xhtml.php

  • XHTML-aware helper function to try and get to a nice grammatical point to call our substring terminus.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: bool

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$naive_end_pos integer No No required parameter N/A N/A The naive position where we'd end on
$grammar_completeness_tolerance float No No required parameter N/A N/A A fraction of the length we may exceed by in order to maintain grammar tolerance (finish sentences, finish paragraphs, finish the whole thing)
$real_offset integer No No required parameter N/A N/A Current offset in the text
$html string No No required parameter N/A N/A The text to perform on
$desired_length integer No No required parameter N/A N/A Desired (naive) substring length
$testing_ahead boolean No No False N/A N/A Whether this is a cursory look-ahead rather than a byte-by-byte callback (therefore skip fine-grained checks which would interfere with a cursory result)

Returns

  • Whether to keep continuing
  • Type: boolean
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * XHTML-aware helper function to try and get to a nice grammatical point to call our substring terminus.
 *
 * @param  integer $naive_end_pos The naive position where we'd end on
 * @param  float $grammar_completeness_tolerance A fraction of the length we may exceed by in order to maintain grammar tolerance (finish sentences, finish paragraphs, finish the whole thing)
 * @param  integer $real_offset Current offset in the text
 * @param  string $html The text to perform on
 * @param  integer $desired_length Desired (naive) substring length
 * @param  boolean $testing_ahead Whether this is a cursory look-ahead rather than a byte-by-byte callback (therefore skip fine-grained checks which would interfere with a cursory result)
 * @return boolean Whether to keep continuing
 */

function _smart_grammar_says_continue(int $naive_end_pos, float $grammar_completeness_tolerance, int $real_offset, string $html, int $desired_length, bool $testing_ahead = false) : bool