我对Java很陌生。我用 php 编写了我的 NER 脚本,如下所示:
require './src/StanfordNLP/Base.php';
require './src/StanfordNLP/Exception.php';
require './src/StanfordNLP/Parser.php';
require './src/StanfordNLP/StanfordTagger.php';
require './src/StanfordNLP/NERTagger.php';
$pos = new \StanfordNLP\NERTagger(
'C:/xampp_new/htdocs/stanford-ner-2015-04-20/classifiers/english.conll.4class.distsim.crf.ser.gz',
'C:/xampp_new/htdocs/stanford-ner-2015-04-20/stanford-ner.jar'
);
$text= "The Federal Reserve Bank of New York led by Timothy R. The electricity was not discovered by Alexander Graham bell";
$text = str_replace(".",",",$text);
$result = $pos->tag(explode(' ', " $text"));
var_dump($result);
但问题是,我想将包推送到实时服务器。NER 是 Java,我的脚本是 php。
我尝试将 stanford-ner.jar 推送到 java 主机上,并将脚本的其余部分推送到 apache 主机上,然后将上面的 $pos 更改为:
$pos = new \StanfordNLP\NERTagger(
'C:/xampp_new/htdocs/stanford-ner-2015-04-20/classifiers/english.conll.4class.distsim.crf.ser.gz',
'http://www.example.com/stanford-ner.jar'
);
它不起作用。请帮忙