Undefined Offset

46 views
Skip to first unread message

alvar...@gmail.com

unread,
Apr 24, 2015, 11:40:48 AM4/24/15
to phpspe...@googlegroups.com

Hello,

I'm testing PHPSpellCheck and have it pretty much working, except that I'm getting a "notice" about an undefined offset in the engine when I setup the Dictionary path:

$spellcheckObject->DictionaryPath = ("../phpspellcheck/dictionaries/"); # Set up the file path to the (.dic) dictionaries folder

returns the notice

Notice: Undefined offset: 2 in /vol/www/trunk/https/phpspellcheck/core/php/engine.php(327) : eval()'d code(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code on line 997

This does NOT happen when I use the examples, but it happens when I use my own page.

My path structure is:

/var/www/https/ <-- "root"
/phpspellcheck
/lector

I'm calling things from inside "lector", therefore using "../phpspellcheck/dictionaires", since this is using a "core" module for custom spell checking on the server side (which I need to do; I do NOT active "spell as you type" unless the server side detects errors first, its an educational program).

The dictionary loads correctly, but I need to get rid of the notice since we display notices even in production (I like to think that even "notices" merit being looked at, because they usually mean bad programing somewhere).

The JS things load correctly, those do not have a problem (eg SpellAsYouType -> InstallationPath = "/phpspellcheck" does not have a problem).

Your help to get rid of this notice is greatly appreciated, so that I can get a license and start using this asap (the rest of my code is ready, I'm really happy with PHPSpellCheck so far!)

Thank you,

Alvar

https://107.21.223.117/lector/pruebaTX.php

(enter a string and submit, it will then load PHPSpellCheck with the code below)

The main part of the code is straight from the example:

require "../phpspellcheck/include.php";

# Create a PHPSpellCheck Core Engine Instance ;
$spellcheckObject = new PHPSpellCheck();

# Copy and Paste your license key here. Buy one onlline at www.phpspellcheck.com
$spellcheckObject -> LicenceKey="TRIAL";

# BASIC SETTINGS
$spellcheckObject->IgnoreAllCaps = false;
$spellcheckObject->IgnoreNumeric = false;
$spellcheckObject->CaseSensitive = true;

$spellcheckObject->DictionaryPath = ("../phpspellcheck/dictionaries/"); // Set up the file path to the (.dic) dictionaries folder
$spellcheckObject->LoadDictionary("Espanol") ; // Loads a dictionary - you can load more than one at the same time */
$spellcheckObject->SuggestionTollerance = 1; // Sets the tollerance of the spellchecker to 'unlikely' suggestions. 0=intollerant ... 10=very tollerant

alvar...@gmail.com

unread,
Apr 24, 2015, 12:04:52 PM4/24/15
to phpspe...@googlegroups.com, alvar...@gmail.com
Update:

After trying to go line-by-line differences, I was able to reproduce the error in the example by *LoadDictionary", rather than setting the path!

The "notices" happen when I change:

$spellcheckObject->LoadDictionary("Espanol");

which is the only dictionary I want used, I don't want English words to be recognized...

How do I tell it to only use "Espanol" without getting the notices?

Hope this debugging helps you help me...

Alvar
Reply all
Reply to author
Forward
0 new messages