我对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'
);
它不起作用。请帮忙