/** * function run_spellcheck() * A function to run the spellchecking of the userinput * @param array $convoArr - the conversation array * @return $convoArr (spellchecked) **/ function run_spell_checker($convoArr) { $lookingfor = get_convo_var($convoArr, "aiml", "lookingfor"); $wordArr = explode(' ', $lookingfor); foreach ($wordArr as $index => $word) { $sentance .= spell_check($word, $convoArr['conversation']['bot_id']) . " "; } $convoArr['aiml']['lookingfor'] = $sentance; return $convoArr; }
/** * function run_spellcheck_say() * A function to run the spellchecking of the userinput * * @param string $say - The user's input * @return string $say (spellchecked) */ function run_spell_checker_say($say) { global $bot_id; runDebug(__FILE__, __FUNCTION__, __LINE__, 'Starting function and setting timestamp.', 2); $sentence = ''; $wordArr = explode(' ', $say); foreach ($wordArr as $index => $word) { $sentence .= spell_check($word, $bot_id) . " "; } return trim($sentence); }