我有一个项目正在使用这个包agentile/PHP-Stanford-NLP(PHP接口到斯坦福NLP工具(POS Tagger,NER,Parser)调用几个.jar文件.一切都在localhost(MAMP)上工作正常但是当我将它部署到laravel forge时它不再工作了.我在服务器中安装了JRE/JDK,Oracle JDK,Oracle JDK 8.
这是我用来调用java文件的代码段:
$parser = new \StanfordNLP\Parser(
public_path().'/stanford-parser.jar',
public_path().'/stanford-parser-3.4.1-models.jar'
);
$parser = $parser->parseSentence($text);
Run Code Online (Sandbox Code Playgroud)
这是错误来自的代码段:
$parser = $this->lexicalized_parser ? 'edu/stanford/nlp/models/lexparser/englishFactored.ser.gz' : 'edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz';
$osSeparator = $this->php_os == 'windows' ? ';' : ':';
$cmd = $this->getJavaPath()
. " $options -cp \""
. $this->getJar()
. $osSeparator
. $this->getModelsJar()
. '" edu.stanford.nlp.parser.lexparser.LexicalizedParser -encoding UTF-8 -outputFormat "'
. $this->getOutputFormat()
. "\" "
. $parser
. " "
. $tmpfname;
$process = proc_open($cmd, $descriptorspec, $pipes, dirname($this->getJar()));
Run Code Online (Sandbox Code Playgroud)
这是错误:
Error: Could not …Run Code Online (Sandbox Code Playgroud)