I have a simple PHP function that is supposed to execute a Pyton script when its called. I have tried this sort of function multiple times in my php programs, but somehow th
There is no issue with the exec() or anything.
The problem is that the nltk module is not able to locate the nltk_data directory. For it just locate where the nltk_data is present in your system: usually ~/nltk_data.
Now import add that path when you run the function.
import nltk;
Now, nltk.data.path is a list of locations where to search for the modules.
You can just do nltk.data.path.append("your location/directory");