[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Aspell-user] aspell with speller pages on windows 2003
From: |
William D. Wright |
Subject: |
[Aspell-user] aspell with speller pages on windows 2003 |
Date: |
Sun, 29 Feb 2004 03:42:52 -0500 |
hi i am going with aspell because it is the best option for me at the moment
but i am getting an error in the speller pages interface when trying to run
the command of the exe aspell.exe the error is.
textinputs[0] = unescape('hello%20woorld'); textinputs[1] = unescape('');
error = 'System error: Aspell program execution failed (`C:\Program
Files\Aspell\bin\aspell.exe -a --lang=en_US-only.rws < ./\asp49.tmp`)';
with this being the lines of code affected any ideas.
## get the list of misspelled words. Put the results in the javascript words
array
## for each misspelled word, get suggestions and put in the javascript suggs
array
function print_checker_results() {
global $aspell_prog;
global $aspell_opts;
global $tempfiledir;
global $textinputs;
global $input_separator;
# create temp file
$tempfile = tempnam( $tempfiledir, 'aspell_data_' );
# open temp file, add the submitted text.
if( $fh = fopen( $tempfile, 'w' )) {
for( $i = 0; $i < count( $textinputs ); $i++ ) {
$text = urldecode( $textinputs[$i] );
$lines = explode( "\n", $text );
fwrite ( $fh, "%\n" ); # exit terse mode
fwrite ( $fh, "^$input_separator\n" );
fwrite ( $fh, "!\n" ); # enter terse mode
foreach( $lines as $key=>$value ) {
# use carat on each line to escape possible aspell commands
fwrite( $fh, "^$value\n" );
}
}
fclose( $fh );
# exec aspell command
$cmd = "$aspell_prog $aspell_opts < $tempfile";
if( $aspellret = shell_exec( $cmd )) {
$linesout = explode( "\n", $aspellret );
$index = 0;
$text_input_index = -1;
# parse each line of aspell return
foreach( $linesout as $key=>$val ) {
$chardesc = substr( $val, 0, 1 );
# if '&', then not in dictionary but has suggestions
# if '#', then not in dictionary and no suggestions
# if '*', then it is a delimiter between text inputs
if( $chardesc == '&' || $chardesc == '#' ) {
$line = explode( " ", $val, 5 );
print_words_elem( $line[1], $index, $text_input_index );
if( isset( $line[4] )) {
$suggs = explode( ", ", $line[4] );
} else {
$suggs = array();
}
print_suggs_elem( $suggs, $index, $text_input_index );
$index++;
} elseif( $chardesc == '*' ) {
$text_input_index++;
print_textindex_decl( $text_input_index );
$index = 0;
}
}
} else {
error_handler( "System error: Aspell program execution failed
(`$cmd`)" );
}
} else {
error_handler( "System error: Could not open file '$tempfile' for
writing" );
}
# close temp file, delete file
unlink( $tempfile );
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Aspell-user] aspell with speller pages on windows 2003,
William D. Wright <=