Skip to content

Dharin-shah/pruning-radix-trie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trie Search Library

A Python library for efficient string search and retrieval with spell correction.

Features

  • Efficient string insertion and search using a Trie (Radix Tree) data structure.
  • Spell correction using Levenshtein distance.
  • Configurable search limit and max edit distance for spell correction.
  • Term frequency count for ranking search results.
  • Support for additional metadata like entity type, neighbors, and canonical form.

Installation

TODO

Usage

from trie_search import Trie

# Create a Trie instance
trie = Trie()

# Insert words into the Trie
trie.insert("apple", 5, "fruit", [], "Apple")
trie.insert("banana", 7, "fruit", [], "Banana")

# Search for a word
results = trie.search("appl")
print(results)

# Search with spell correction
results = trie.search_with_correction("banan")
print(results)

# Update term frequency count
trie.update("apple", 3)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages