您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

匹配POS标签和单词序列

匹配POS标签和单词序列

首先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 nice
alvas@ubi:~/git/nltk_cli$ python senna.py --chunk2 VP+ADJP infile.txt 
would be    really cool
would 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 be
the Syntax editor   would be
alvas@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条件即可。

其他 2022/1/1 18:32:15 有493人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶