SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: spell checker

  1. #1
    SitePoint Addict nimasdj's Avatar
    Join Date
    Dec 2007
    Posts
    314
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    spell checker

    Since google spell checker API is closed I tried this: https://github.com/AlphawolfWMP/google-spell-pspell
    and got this:
    Warning: pspell_new_config() [function.pspell-new-config]: PSPELL couldn't open the dictionary. reason: No word lists can be found for the language "en".
    How can I use that class?

  2. #2
    SitePoint Zealot bronze trophy xMog's Avatar
    Join Date
    Mar 2011
    Posts
    159
    Mentioned
    3 Post(s)
    Tagged
    2 Thread(s)
    Did you try to add this at the beginning?
    Code:
    $pspell_config = pspell_config_create("en");
    $pspell_link = pspell_new_config($pspell_config);

  3. #3
    SitePoint Addict nimasdj's Avatar
    Join Date
    Dec 2007
    Posts
    314
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How this should be? like below?

    Code:
    require_once('spell-check-library.php');
    $content = "";
    $options = array(
        "lang"                  => 'en',
        "maxSuggestions"        => 10,
        "customDict"            => 0,
        "charset"               => 'utf-8'
    );
    $pspell_config = pspell_config_create("en");
    $pspell_link = pspell_new_config($pspell_config);
    $factory = new SpellChecker($options);
    $spell = $factory->create(trim($_GET['message']));
    header('Content-Type: text/xml; charset=UTF-8');
    echo $spell->toXML();

  4. #4
    SitePoint Zealot bronze trophy xMog's Avatar
    Join Date
    Mar 2011
    Posts
    159
    Mentioned
    3 Post(s)
    Tagged
    2 Thread(s)
    I found the exact error in http://www.php.net/manual/en/ref.pspell.php
    It says:
    Add following lines prior to calling pspell_check:
    $pspell_config = pspell_config_create("en");
    $pspell_link = pspell_new_config($pspell_config);

  5. #5
    SitePoint Addict nimasdj's Avatar
    Join Date
    Dec 2007
    Posts
    314
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code you gave is for when we want to use pspell extensions directly but the code i gave is for a particular class file with different structure so that code in php doc is irrelevant for my problem. Pleade look further and help.


Bookmarks

Posting Permissions

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