Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Golang Keyword extraction/replacement Datastructure using Tries instead of regexes

NotificationsYou must be signed in to change notification settings

dav009/flash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fast Keyword extraction usingAho–Corasick algorithm and Tries.

Flash is a Golang reimplementation ofFlashtext,

This is meant to be used when you have a large number of words that you want to:

  • extract from text
  • search and replace

Flash is meant as a replacement for Regex, which in such cases can be extremely slow.

Usage

import"github.com/dav009/flash"words:=flash.NewKeywords()words.Add("New York")words.Add("Hello")words.Add("Tokyo")foundKeywords:=words.Extract("New York and Tokyo are Cities")fmt.Println(foundKeywords)// [New York, Tokyo]

Benchmarks

As a reference using go-flash with 10K keywords in a 1000 sentence text, took 7.3ms,while using regexes took 1minute 37s.

SentencesKeywordsString.ContainsRegexGo-Flash
100010K1.0035s1min 37s2.72ms

Warning

This is a toy-project for me to get more familiar with GolangPlease be-aware of potential issues.

About

Golang Keyword extraction/replacement Datastructure using Tries instead of regexes

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp