访问annif rest api的python客户端库

annif-client的Python项目详细描述


安宁客户

这是一个用于访问 Annif可用于自动主题的rest api 文本文档的索引和分类。

安装

最简单的安装方法是通过pip:

pip3 install annif-client

依赖关系

图书馆依赖于 requests使用的模块 用于http/rest访问。如果通过pip安装,依赖项将是 自动处理。

如何使用

客户端库附带了演示其用法的示例。你可以调用 运行annif_client.py脚本的示例。

在您自己的代码中,您可以像这样使用annifclient类:

from annif_client import AnnifClient

# then you can create your own client
annif = AnnifClient()

调用示例

下面是典型示例会话的输出:

$ python3 annif_client.py
Demonstrating usage of AnnifClient

* Creating an AnnifClient object
Now we have an AnnifClient object: AnnifClient(api_base='http://api.annif.org/v1/')

* Finding the available projects
Project id: yso-fi           lang: fi  name: YSO ensemble Finnish
Project id: yso-sv           lang: sv  name: YSO ensemble Swedish
Project id: yso-en           lang: en  name: YSO ensemble English
Project id: tfidf-fi         lang: fi  name: TF-IDF Finnish
Project id: tfidf-sv         lang: sv  name: TF-IDF Swedish
Project id: tfidf-en         lang: en  name: TF-IDF English
Project id: fasttext-fi      lang: fi  name: fastText Finnish
Project id: fasttext-sv      lang: sv  name: fastText Swedish
Project id: fasttext-en      lang: en  name: fastText English
Project id: maui-fi          lang: fi  name: Maui Finnish
Project id: maui-sv          lang: sv  name: Maui Swedish
Project id: maui-en          lang: en  name: Maui English
Project id: annif-api-fi     lang: fi  name: Annif prototype API Finnish
Project id: annif-api-sv     lang: sv  name: Annif prototype API Swedish
Project id: annif-api-en     lang: en  name: Annif prototype API English
Project id: ykl-fasttext-fi  lang: fi  name: YKL fastText Finnish

* Looking up information about a specific project
Project id: yso-en           lang: en  name: YSO ensemble English

* Analyzing a short text from a string
<http://www.yso.fi/onto/yso/p2228>	0.2595	red fox
<http://www.yso.fi/onto/yso/p5319>	0.2039	dog
<http://www.yso.fi/onto/yso/p8122>	0.1946	laziness
<http://www.yso.fi/onto/yso/p25726>	0.1285	brown
<http://www.yso.fi/onto/yso/p4760>	0.1220	triple jump
<http://www.yso.fi/onto/yso/p4758>	0.1194	long jump
<http://www.yso.fi/onto/yso/p2229>	0.1109	canines
<http://www.yso.fi/onto/yso/p10636>	0.1094	blue fox
<http://www.yso.fi/onto/yso/p4759>	0.1068	high jump
<http://www.yso.fi/onto/yso/p28336>	0.0911	animal training

* Analyzing a longer text from a file, with a limit on number of results
<http://www.yso.fi/onto/yso/p16495>	0.3651	licences (permits)
<http://www.yso.fi/onto/yso/p2346>	0.1656	copyright
<http://www.yso.fi/onto/yso/p11657>	0.1566	national libraries
<http://www.yso.fi/onto/yso/p6068>	0.1461	Apache
<http://www.yso.fi/onto/yso/p14833>	0.1220	copies

许可证

代码是在Apache 2.0许可证下发布的。

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

推荐PyPI第三方库


热门话题
java传递实现接口的内部类   java为什么managedbean方法在post请求中的过滤器调用之前调用   java Android应用程序在Android M,O上崩溃,登录A/libc时出错:tid 17938中的致命信号11(SIGSEGV),代码2,故障地址0x343a2944   java JPA存储库。findByAll()返回null,但数据库中存在所有内容   用于发送电子邮件的java Ant脚本   Java小程序HTML页面发生了奇怪的事情   在Postman的请求正文中传递多个JSON数据,并使用Jersy(JXRS)进入Java Rest API   无法强制转换java DAO类   10分钟后重新连接java   正则表达式如何在java中选择字符串直到某个字符   java我的输出有一些问题   Objective中的java时间段   java如何在新屏幕上基于按钮单击在webview中打开url   java哪个selenium版本与Firefox ESR 45.2.0兼容   java无法使用Apache Camel 3.1.0将XML转换为JSON