首先
nltk_cli按照说明安装:https :
//github.com/alvations/nltk_cli
然后,这是中的一个秘密函数
nltk_cli,也许您会发现它很有用:
alvas@ubi:~/git/nltk_cli$ cat infile.txt something like how writer pro or phraseology works would be really cool .more options like the syntax editor would be nicealvas@ubi:~/git/nltk_cli$ python senna.py --chunk2 VP+ADJP infile.txt would be really coolwould be nice
为了说明其他可能的用法:
alvas@ubi:~/git/nltk_cli$ python senna.py --chunk2 VP+VP infile.txt !!! NO CHUNK of VP+VP in this sentence !!!!!! NO CHUNK of VP+VP in this sentence !!!alvas@ubi:~/git/nltk_cli$ python senna.py --chunk2 NP+VP infile.txt how writer pro or phraseology works would bethe syntax editor would bealvas@ubi:~/git/nltk_cli$ python senna.py --chunk2 VP+NP infile.txt !!! NO CHUNK of VP+NP in this sentence !!!!!! NO CHUNK of VP+NP in this sentence !!!
然后,如果您要检查句子中的短语并输出True / False,只需读取并遍历输出
nltk_cli并检查
if-else条件即可。



