Skip to content

Implemented with Aho-Corasick Automaton, with an Example of Mobile Detect.

Notifications You must be signed in to change notification settings

zhixiangli/keyword-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

keyword-search

Keyword Search is implemented with Aho-Corasick Automaton, with a case of mobile detect.

Time Complexity: O(n), faster than other algorithms, such as indexOf().

Environmental Requirements

JDK 1.8+

Instructions

Add Dependency

<dependency>
	<groupId>com.zhixiangli</groupId>
	<artifactId>keyword-search</artifactId>
	<version>0.0.1</version>
</dependency>

Example

KeywordSearch keywordSearch = new KeywordSearch();
// [must] add all keyword at one time.
keywordSearch.addAll(new String[] {"a", "bc", "def"});
System.out.println(keywordSearch.contains("bef")); // false
System.out.println(keywordSearch.contains("bobcome")); // true

About

Implemented with Aho-Corasick Automaton, with an Example of Mobile Detect.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages