用于确定文本观点(第一、第二、第三或未知)的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中的安卓字节[]操作   java如何使用SeleniumWebDriver自动弹出对话框窗口   运行单黄瓜JVM的java。来自Gradle的功能文件   在Java中使用JTA连接到SSH   eclipse为什么在从SVN签出Ant版本1.3时,Ant java项目本身有很多错误?   java如何获取撇号之间的字符串   java锁在单个线程上作为布尔信号量工作吗?   bluej我可以使用什么代码清除屏幕(java)?   java在单击JButton时更改JPanel图标   java将逗号分隔的字符串转换为不带中间容器的列表   java Flink:以集群模式加载资源文件   java删除多对多条目,同时将两个对象都保留在数据库中   将数组值向左移动