用于确定文本观点(第一、第二、第三或未知)的python包。

pointofview的Python项目详细描述


Latest PyPI versionLatest Travis CI build statusLatest Codacy Coverage Report

用于确定文本观点(第一、第二、第三或未知)的python包。

安装

pointofview在pypi上可用。只需使用pip

安装
$ pip install pointofview

您也可以从源代码安装它:

$ git clone https://github.com/prosegrinder/python-pointofview.git
Cloning into 'python-pointofview'...
...

$ cd python-pointofview
$ python setup.py install
...

用法

pointofview通过计算视点代词来猜测文本的视点。主函数get_text_pov()将返回“first”、“second”、“third”或null(python的None对象):

>>> import pointofview
>>> text = "I'm a piece of text written in first person! What are you?"
>>> pointofview.get_text_pov(text)
'first'

还有另外两个助手函数。

get_word_pov()返回单个单词的视角:

>>> pointofview.get_word_pov("I")
'first'
>>> pointofview.get_word_pov("nope")
None

parse_pov_words返回包含所有第一、第二和第三人称pov单词的dict:

>>> text = """
... When I try to analyze my own cravings, motives, actions and so forth, I surrender to a sort of retrospective imagination which feeds the analytic faculty with boundless alternatives and which causes each visualized route to fork and re-fork without end in the maddeningly complex prospect of my past.
... """
>>> pointofview.parse_pov_words(text)
{'first': ['i', 'i'], 'second': [], 'third': []}

作者

视点David L. Day编写。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何使用java在linux上编写系统日志   如何在同一个现有变量上多次更改变量的值?(爪哇)   易失性字符串Java   java需要帮助通过PreparedStatement编写适当的搜索查询   JavaMaven项目是否获得其他Maven项目的版本?   java如何在Eclipse中使用Drool应用程序抑制信息和警告调试信息   Java中FileReader和FileInputStream的区别是什么?   java如何为此编写HQL查询?   java方法根本不返回任何内容   VLCJ通过单个java程序控制多个音频文件   java为什么这个println命令不开始一个新行?   java如何创建自己的文件扩展名。odt或。医生?   声明字符串后,java在条件语句中设置int值   通过k8s作业文件将cmd参数传递给docker容器中的java应用程序