Skip to content

onexuan/android-Aho-Corasick

 
 

Repository files navigation

Android Aho-Corasick Sample

This sample is an example of string matching using the Aho-Corasick algorithm.

Introduction

This sample is an Android Project of string matching using the Aho-Corasick algorithm.

Aho-Corasick algorithm is a very efficient dictionary matching algorithm that can locate all search patterns against in input text simultaneously in O(n + m), with space complexity O(m) (where n is the length of the input text, and m is the combined length of the search patterns).

This project uses native languages (JNI), assuming high computational complexity. We used cjgdev/aho_corasick which implements the algorithm of Aho-Corasick by C++.

cjgdev/aho_corasick implements three configs, which also implement JNI functions.

  • check CaseInsensitive ("casing"), "CaSiNg" =[0, 5] casing
  • check RemoveOverlaps ("hot", "hot chocolate"), "hot chocolate" =[0, 12] hot chocolate
  • check setOnlyWholeWords ("sugar"), "sugarcane sugar" =[10, 15] sugar

Please see the link below for a detailed explanation of the Aho-Corasick algorithm.

Screenshots

Screenshot Screenshot

Reference

About

Android Aho-Corasick algorithm using JNI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 69.4%
  • Java 24.9%
  • CMake 5.7%