Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to use PHP pspell_config_repl

    I am attempting to do a spell-checker that does the google "is this what you meant" thing. I have this function that I enter a word and I want it to use the replace suggestions from "/dict/replace.txt" but it only gives me suggestions from PHP's built-in dictionary.

    What am I doing wrong so that the pspell_config_repl feature isn't working with the pspell_suggest function?

    I am using the following code:

    PHP Code:
    spellCheck("tee");

    function 
    spellCheck($word) {
        
    $p_cfg pspell_config_create("en");
        
    pspell_config_personal($p_cfg"/dict/dictionary.txt");
        
    pspell_config_repl($p_cfg"/dict/replace.txt");
        
    $p_link pspell_new_config($p_cfg);
        
        
    $su pspell_suggest($p_link$word);
        if (
    $su) {
            
    // Return first suggested word
            
    return $su[1];
        } else {
            
    // Return word
            
    return $word;

    Last edited by devils19; 12-24-2010 at 09:40 PM.


 

Posting Permissions

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