【发布时间】:2016-10-28 15:07:51
【问题描述】:
我有两个代码 sn-ps:-
1) get_pos_tags.py
import sys
import json
from nltk.tokenize import word_tokenize
from nltk.tag import pos_tag
def getPOSTags(sentence=sys.argv[1]):
sentence_s=str(sentence)
word_token=word_tokenize(sentence_s)
print word_token
word_POS_tags=pos_tag(word_token)
if __name__=='__main__':
getPOSTags()
2)test.php
<?php
$sentence="I became the king of rome";
echo("python get_pos_tags.py "."'".$sentence."'",$output);
var_dump($output);
当我在 xampp 上运行 test.php 时,我收到 xampp 的输出为 null 而我应该以 python List 的形式获得输出。谁能帮忙看看这段代码有什么问题?我正在使用 MAC OS X El Capitan 和 PHP7。
【问题讨论】: