blester125 / inverted-index

A simple, extensible inverted index for python to quickly add simple searching to a script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inverted Index

PyPi Version Actions Status Code style: black

A small extensiable python inverted index. It supports retevial by boolean ANDs and ranking of the returned results. The point is a skeleton to add quick and dirty search to a script.

It also includes a prompt_toolkit completer that can each the inverted index as you type. When you select a auto-suggest option it will replace your prompt. The best way I have found to use this is to set it up to trigger only when you ask by hitting tab like so:

from prompt_toolkit import prompt
from inverted_index.prompt import SearchCompleter
from inverted_index.inverted_index import InvertedIndex


# Create your index
ii = InvertedIndex(...)
ii.index(my_documents)

user_input = prompt("> ", completer=SearchCompleter(ii), complete_while_typing=False)
# Do things with user_input
print(user_input)

About

A simple, extensible inverted index for python to quickly add simple searching to a script

License:MIT License


Languages

Language:Python 100.0%