用python编写的通用索引器。

indexr的Python项目详细描述


https://img.shields.io/pypi/v/indexr.svghttps://img.shields.io/travis/kevin91nl/indexr.svghttps://readthedocs.org/projects/indexr/badge/

用python编写的通用索引器。根据麻省理工学院的许可证。

功能

indexr.buildr包能够构造反向索引。

indexr.utils包包含实用程序,例如用于将文本转换为标记的标记化方法。

设置

此软件包可以使用pip安装:

pip install indexr

示例

在本例中,索引器是为3个文件构造的。示例使用以下3个文件:

0.txt

The0thdocument.

1.txt

The1stdocument.

2.txt

The2nddocument.Somewords:repeat,repeat,repeat.

下面的代码示例可以在demo目录(demo/buildr.py)中找到。

# Build the indexindex=build_index(files,'index',force_rebuild=True,indexer=SPIMI(show_progress=True))# Try to find the word "1st"print('All found occurrences of "1st":')print(index.find('1st',frequencies=True),"\n")# Try to find the word "The"print('All found occurrences of "The":')print(index.find('The',frequencies=True),"\n")# Try to find the word "repeat"print('All found occurrences of "repeat":')print(index.find('repeat',frequencies=True),"\n")

它提供以下输出:

>>>Allfoundoccurrencesof"1st":>>>{'1.txt':1}>>>>>>Allfoundoccurrencesof"The":>>>{'0.txt':1,'1.txt':1,'2.txt':1}>>>>>>Allfoundoccurrencesof"repeat":>>>{'2.txt':3}

因此,它确实找到了1个“1st”,3个“the”(每个文件中出现1次)和3个“repeat”(一个文件中出现3次)。

学分

用于呈现此包的工具:

历史记录

1.0.1(2015-12-07)

  • 第一个版本,包括bsb算法和spimi算法。

0.1.0(2015-12-04)

  • pypi上的第一个版本。

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

推荐PyPI第三方库


热门话题
java表单:在Spring中没有在JSP上显示错误的错误   java如何在springboot服务中管理springcloudazure依赖关系?   java在Hibernate 3.6中,如何在主键上正确地级联保存一个一对一的双向关系   java如何使用Dagger 2.11+将依赖项注入服务流程?   java如何为许多URL设置CacheContro   JAVAutil。日志自定义格式化程序未按预期工作   java支付计算器未正确重置   java Tomcat应用程序无法看到我的$PATH变量   java对设置@transactional的值感到困惑   java删除SQLite数据库中的任务   Java Hibernate/Spring,正在执行部分匹配查询(“包含”)?   未编制索引的字段上的java部分更新   java如何获取URL中的数字?   java如何通过okhttp在Android studio上显示来自服务器(flask)的图像url   java使用Xstream忽略了xml的一些字段   java HTTPClient提交输入