Skip to main content

A general purpose indexer written in Python.

Project description

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

A general purpose indexer written in Python. Licensed under the MIT license.

Features

The indexr.buildr package is capable of constructing an inverted index.

The indexr.utils package contains utilities, such as a tokenization method for converting a text to tokens.

Setup

This package can be installed using pip:

pip install indexr

Examples

In this example, an indexer is constructed for 3 files. The example uses the following 3 files:

0.txt:

The 0th document.

1.txt:

The 1st document.

2.txt:

The 2nd document. Some words: repeat, repeat, repeat.

The following code sample can be found in the demo directory (demo/buildr.py).

# Build the index
index = 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")

It gives the following output:

>>> All found occurrences of "1st":
>>> {'1.txt': 1}
>>>
>>> All found occurrences of "The":
>>> {'0.txt': 1, '1.txt': 1, '2.txt': 1}
>>>
>>> All found occurrences of "repeat":
>>> {'2.txt': 3}

So indeed, it finds 1 occurrence of “1st”, 3 occurrences of “The” (1 occurrence in each file) and 3 occurrences of “repeat” (3 occurrences in one file).

Documentation

https://indexr.readthedocs.org

Credits

Tools used in rendering this package:

History

0.1.12 (2015-12-05)

  • Added SPIMI algorithm and benchmarking script.

0.1.0 (2015-12-04)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

indexr-0.1.12.zip (24.9 kB view details)

Uploaded Source

Built Distribution

indexr-0.1.12-py2.py3-none-any.whl (12.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file indexr-0.1.12.zip.

File metadata

  • Download URL: indexr-0.1.12.zip
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for indexr-0.1.12.zip
Algorithm Hash digest
SHA256 873eaf1307a3871bc9c6fbae67be0e3661a28f3ca57c4c70e672aa87ca2f6e3c
MD5 ec5602ddaff89e5cbf7bc24d1531bea1
BLAKE2b-256 b0f3400a11462648b31ce88e34c02f9736d8d9604f8dded9adeff2e92d90f2b7

See more details on using hashes here.

File details

Details for the file indexr-0.1.12-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for indexr-0.1.12-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fd91a64d4091ce423d443e176ae5b1754ca3d89628170317170380403bcc3838
MD5 f2c2c29322c927d231083e16d3072ae1
BLAKE2b-256 60a5a73404fdac2896c9fe1a2ee5f96df69c021be4c1e001d956ac0b6dd7ac64

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page