Function __global->run_spellcheck

Definitions

sources/spelling.php

  • Run a spellcheck on some text.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$text string No No required parameter N/A N/A Text to scan for words in (should be plain text, not be HTML or Comcode text)
$lang ?ID_TEXT No No Null N/A N/A Language to check in (null: current language)
$skip_known_words_in_db boolean No No True N/A N/A Whether to avoid spellchecking known keywords etc
$provide_corrections boolean No No True N/A N/A Whether to provide corrections
$unicode_accepted boolean No No True N/A N/A Whether Unicode is accepted

Returns

  • A map of misspellings, lower case bad word => array of corrections (null: error)
  • Type: ?array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Run a spellcheck on some text.
 *
 * @param  string $text Text to scan for words in (should be plain text, not be HTML or Comcode text)
 * @param  ?ID_TEXT $lang Language to check in (null: current language)
 * @param  boolean $skip_known_words_in_db Whether to avoid spellchecking known keywords etc
 * @param  boolean $provide_corrections Whether to provide corrections
 * @param  boolean $unicode_accepted Whether Unicode is accepted
 * @return ?array A map of misspellings, lower case bad word => array of corrections (null: error)
 */

function run_spellcheck(string $text, ?string $lang = null, bool $skip_known_words_in_db = true, bool $provide_corrections = true, bool $unicode_accepted = true) : ?array