PHP-Stanford-NLP icon indicating copy to clipboard operation
PHP-Stanford-NLP copied to clipboard

upgraded to java 1.8 and returned empty array

Open sajidsheik opened this issue 9 years ago • 5 comments

Fatal error: Uncaught exception 'StanfordNLP\Exception' with message 'Model file path does not exist.' in C:\xampp\htdocs\StanfordNLP\POSTagger.php:65 Stack trace: #0 C:\xampp\htdocs\StanfordNLP\POSTagger.php(35): StanfordNLP\POSTagger->setModel('_DIR_C:/xampp/h...') #1 C:\xampp\htdocs\StanfordNLP\index.php(21): StanfordNLP\POSTagger->__construct('_DIR_C:/xampp/h...', '_DIR_C:/xampp/h...') #2 {main} thrown in C:\xampp\htdocs\StanfordNLP\POSTagger.php on line 65

sajidsheik avatar Apr 22 '15 14:04 sajidsheik

hello, try to specify the full path (Absolute path)..

shryvishnu avatar Apr 22 '15 14:04 shryvishnu

i got empty array where do i have to specific the path

sajidsheik avatar Apr 22 '15 14:04 sajidsheik

sry I had already read your post in empty array issue.. but it should work after adding the absolute path as specified :- it must be something like this

 _DIR__ . '/stanford-postagger-full-2015-01-30/models/english-left3words-distsim.tagger',
_DIR__ . '/stanford-postagger-full-2015-01-30/stanford-postagger.jar'

shryvishnu avatar Apr 22 '15 15:04 shryvishnu

i have appiled DIR still it is not working ,when i apply it causes previous errors not the empty array

sajidsheik avatar Apr 22 '15 16:04 sajidsheik

I added this in the code var_dump($pos); and got following error- array(0) { } object(StanfordNLP\POSTagger)#2 (10) { ["model":protected]=> string(103) "C:\xampp\htdocs\PHP-Stanford-NLP\stanford-postagger-2015-04-20\models\english-left3words-distsim.tagger" ["separator":protected]=> string(1) "_" ["tag_type":protected]=> string(3) "pos" ["java_path":protected]=> string(4) "java" ["jar":protected]=> string(85) "C:\xampp\htdocs\PHP-Stanford-NLP\stanford-postagger-2015-04-20\stanford-postagger.jar" ["models_jar":protected]=> NULL ["java_options":protected]=> array(1) { [0]=> string(7) "-mx300m" } ["output":protected]=> NULL ["errors":protected]=> string(207) "Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion' has value '1.8', but '1.7' is required. Error: could not find java.dll Error: Could not find Java SE Runtime Environment. " ["php_os":protected]=> string(7) "windows" }

I even tried installing 1.7 version but then it shows -

array(0) { } object(StanfordNLP\POSTagger)#2 (10) { ["model":protected]=> string(103) "C:\xampp\htdocs\PHP-Stanford-NLP\stanford-postagger-2015-04-20\models\english-left3words-distsim.tagger" ["separator":protected]=> string(1) "_" ["tag_type":protected]=> string(3) "pos" ["java_path":protected]=> string(4) "java" ["jar":protected]=> string(85) "C:\xampp\htdocs\PHP-Stanford-NLP\stanford-postagger-2015-04-20\stanford-postagger.jar" ["models_jar":protected]=> NULL ["java_options":protected]=> array(1) { [0]=> string(7) "-mx300m" } ["output":protected]=> NULL ["errors":protected]=> string(896) "java.lang.UnsupportedClassVersionError: edu/stanford/nlp/tagger/maxent/MaxentTagger : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Exception in thread "main" " ["php_os":protected]=> string(7) "windows" }

Any met to resolve this?

aks17 avatar May 19 '15 13:05 aks17