Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

pspell

Posted on 2011-05-09
5
Medium Priority
?
309 Views
Last Modified: 2012-05-11
Hello,

I'm having a difficult time running this script to remove any words not recognized.

The error I get is: Fatal error: call to undefined function pspell_new() in /home/directory/pspell.php on line 2.

Thank you
      

<?php
$pspell_link = pspell_new("en");
$lines=file('file.txt');
foreach ($lines as $line)
{
        $words=preg_split('/[ \s]+/',trim($line));
        foreach ($words as $word)
        {
                if(pspell_check($pspell_link,$word))
                {
                        echo $word,' ';
                }
        }
        echo "\n";
}
?>
0
Comment
Question by:faithless1
5 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 35725572
Fatal error: call to undefined function -- that is pretty unambiguous.  Maybe you want new Pspell() instead?  You do not have a function named pspell in the script and that is why there is an error message.
0
 
LVL 15

Expert Comment

by:Jagadishwor Dulal
ID: 35725708
You are calling a function which is not defined. If you have created function in a separate page then include it to this current page to call the function pspell_new("en")
0
 
LVL 12

Expert Comment

by:zappafan2k2
ID: 35725809
I read the following on php.net
As of php 5.3. Pspell is no longer supported/bundled. Instead you can use the enchant which is bundled by default in 5.3.
http://php.net/manual/en/book.pspell.php

Perhaps pspell is no longer supported by your hosting company?
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 35727359
@zappafan2k2: I read that, too, but it is a user-contributed note and not part of the PHP documentation.  And I don't believe it.  My PHP version is 5.3.6 and the configure command '--with-pspell' worked perfectly.  I added a fact-check note to the PHP man page, but did not bother to add anything about enchant which is missing from my PHP installation (and I bet from a lot of others, too).  The dearth of user-contributed notes is a clue about the marginal nature of enchant.

It is possible that the hosting company did not include PSpell support, but it sounds like it would make more sense to include it in the build.

http://us3.php.net/manual/en/pspell.requirements.php
http://us3.php.net/manual/en/pspell.installation.php

As you can see from those pages, it ain't that hard!  @faithless1: As your hosting provider to install PSpell support and try it again.
0
 

Author Comment

by:faithless1
ID: 35735219
I wanted to clarify... I'm trying to run this script through the gnome terminal in Ubuntu... I'm not using a server for this and this is not a hosted version. Thank you
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question