Socket
Socket
Sign inDemoInstall

github.com/Vivino/go-autocomplete-trie

Package Overview
Dependencies
2
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/Vivino/go-autocomplete-trie

Package trie provides a data structure for autocompletion searching of strings.


Version published

Readme

Source

Go-Autocomplete-Trie

An autocompl... library for Go by Vivino.

GoDoc Build Status

What Is it

Go-Autocomplete-Trie is a simple, configurable autocompletion library for Go. Simply build a dictionary with a slice of strings, optionally configure, and then search.

How to Use

Make a default Trie like so:

t := trie.New()

The default Trie has fuzzy search enabled, string normalisation enabled, a default levenshtein scheme and is case insensitive by default.

Next, just add some strings to the dictionary.

t.Insert("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")

Next, search.

t.SearchAll("wdn")

-> []string{"Wednesday"}

Levenshtein is enabled by default.

t.SearchAll("urs")

-> []string{"Thursday", "Tuesday"}

To turn off the features...

t.WithoutLevenshtein().WithoutNormalisation().WithoutFuzzy().CaseSensitive()

Now...

t.SearchAll("urs")

-> []string{}

t.SearchAll("Thu")

-> []string{"Thursday"}

FAQs

Last updated on 01 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc