duan0531 2017-04-12 20:19
浏览 48

可捕获的致命错误:参数1传递给CorenlpAdapter :: getOutput()

I get the following error:

Catchable fatal error: Argument 1 passed to CorenlpAdapter::getOutput() must be an instance of string, string given, called in /Library/WebServer/Documents/website/php-stanford-corenlp-adapter/index.php on line 22 and defined in /Library/WebServer/Documents/website/php-stanford-corenlp-adapter/src/CoreNLP/CorenlpAdapter.php on line 95

index.php 21 and 22 contain:

$text1 = 'I will meet Mary in New York at 10pm';
$coreNLP->getOutput($text1);

corenlpAdapter.php lines 95 and onwards contain:

public function getOutput(string $text){

    if(ONLINE_API){
        // run the text through the public API
        $this->getServerOutputOnline($text);
    } else{
        // run the text through Java CoreNLP
        $this->getServerOutput($text);
    }

    // cache result
    $this->serverMemory[] = $this->serverOutput;

    if(empty($this->serverOutput)){
        echo '** ERROR: No output from the CoreNLP Server **<br />
            - Check if the CoreNLP server is running. Start the CoreNLP server if necessary<br />
            - Check if the port you are using (probably port 9000) is not blocked by another program<br />';
        die;
    }

    /**
     * create trees
     */
    $sentences = $this->serverOutput['sentences'];
    foreach($this->serverOutput['sentences'] as $sentence){
        $tree           = $this->getTreeWithTokens($sentence); // gets one tree
        $this->trees[]  = $tree; // collect all trees
    }

    /**
     * add OpenIE data
     */
    $this->addOpenIE();

    // to get the trees just call $coreNLP->trees in the main program
    return;
}

Why exactly am I getting this error when text1 is a string?

  • 写回答

2条回答 默认 最新

  • duanhe2027 2017-04-12 22:35
    关注
    public function getOutput($text){
      .
      .
      .
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!