Package com.lahodiuk.ahocorasick
Class AhoCorasickOptimized
- java.lang.Object
-
- com.lahodiuk.ahocorasick.AhoCorasickOptimized
-
public class AhoCorasickOptimized extends java.lang.ObjectTAKEN FROM: https://github.com/lagodiuk/aho-corasick-optimized/blob/master/src/main/java/com/lahodiuk/ahocorasick/AhoCorasickOptimized.java Implementation of the Aho-Corasick string matching algorithm, described in the paper "Efficient String Matching: An Aid to Bibliographic Search", written by Alfred V. Aho and Margaret J. Corasick, Bell Laboratories, 1975 This implementation takes into account the specificities of the HotSpot JVM, and supposed to be the Garbage Collector friendly. The automaton is based only on the primitive data types in order to avoid Autoboxing and Unboxing conversions.- Author:
- of the implementation is Yurii Lahodiuk (yura.lagodiuk@gmail.com), 2017-11-11: Erik Faessler from the JULIE Lab added the method
isEntryPrefix(String).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAhoCorasickOptimized.MatchCallbackstatic classAhoCorasickOptimized.Util
-
Constructor Summary
Constructors Constructor Description AhoCorasickOptimized(java.lang.String... patterns)AhoCorasickOptimized(java.util.List<java.lang.String> patterns)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadjustFailureTransitionsSize(int actualStatesCount)voidadjustOutputTableSize(int actualStatesCount)voidadjustTransitionsTableSize(int actualStatesCount)java.lang.StringgenerateGraphvizAutomatonRepresentation(boolean displayEdgesToInitialState)booleanisEntryPrefix(java.lang.String text)Added by Erik Faessler, 2017-11-11: This method does not find dictionary entries in the given string but just checks if the given string is a strict prefix of at least one dictionary entry.voidmatch(java.lang.String text, AhoCorasickOptimized.MatchCallback callback)
-
-
-
Method Detail
-
adjustFailureTransitionsSize
public void adjustFailureTransitionsSize(int actualStatesCount)
-
adjustOutputTableSize
public void adjustOutputTableSize(int actualStatesCount)
-
adjustTransitionsTableSize
public void adjustTransitionsTableSize(int actualStatesCount)
-
match
public final void match(java.lang.String text, AhoCorasickOptimized.MatchCallback callback)
-
isEntryPrefix
public final boolean isEntryPrefix(java.lang.String text)
Added by Erik Faessler, 2017-11-11: This method does not find dictionary entries in the given string but just checks if the given string is a strict prefix of at least one dictionary entry. That is, the method returns false for strings that are completely contained in the dictionary and not a prefix of another entry.- Parameters:
text-- Returns:
-
generateGraphvizAutomatonRepresentation
public java.lang.String generateGraphvizAutomatonRepresentation(boolean displayEdgesToInitialState)
-
-