www.webdeveloper.com
Results 1 to 2 of 2

Thread: Help plz, what algorithm is used for the spellchecker in this code?

  1. #1
    Join Date
    Jul 2013
    Posts
    5

    Help plz, what algorithm is used for the spellchecker in this code?

    PHP Code:
    function spellcheck($word) {
      
    $output =   array();
      
    $word =     mysql_real_escape_string($word);
      
      
    $words mysql_query("SELECT  `word` FROM  `english` WHERE LEFT( `word`, 1) = '".substr($word01)."'");
        if (!
    $words) {
        die(
    'Invalid query: ' mysql_error());
    }
      
      while((
    $words_row mysql_fetch_assoc($words)) !== false && (in_array($word$words_row) == false)) {
         
    similar_text($word$words_row['word'], $percent) ;
        
    // echo $words_row['word'].' presentasi ' .$percent .' <p>';
          
    if ($percent 75) {
          
        echo 
    '<fieldset>' .'do you mean' '<u>' '<p>'$words_row['word']. '</u>'.'</fieldset>';
        echo 
    '<p>';
           }
          
      
      }
    return (empty(
    $output)) ? false $output;

    }
    if (isset(
    $_POST ['word']) && trim($_POST['word']) != null) {

    $word $_POST['word'];
    $spellcheck spellcheck ($word);

    if(
    $spellcheck !== false){
    echo (
    "<fieldset>, '<pre> ',print_r($spellcheck, true), ' </prev>', </fieldet></h1>") ;


    }


     
    // echo("dont know dat word!! Data w blum updated lu!");
    //}
    mysql_close($link);

    Last edited by NogDog; 07-07-2013 at 07:52 PM. Reason: added [php] tags around code

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    It's just checking to see if the word exists in a database table full of words.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles