Package org.aksw.jenax.arq.analytics
Class PrefixAccumulator<E>
java.lang.Object
org.aksw.jenax.arq.analytics.PrefixAccumulator<E>
- All Implemented Interfaces:
Serializable,org.aksw.commons.collector.domain.Accumulator<String,E, Set<String>>
public class PrefixAccumulator<E>
extends Object
implements org.aksw.commons.collector.domain.Accumulator<String,E,Set<String>>, Serializable
Class for accumulating a set of prefixes with a specified target size from a set of strings
- Author:
- raven
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccumulate(String prefix, E env) static StringcommonPrefix(String sa, String sb, boolean skipLast) Returns the common prefix of the given stringsstatic StringdefaultGrouper(String prefix) static <T> Set<T>flatMapMapValues(Map<?, ? extends Collection<T>> map) getValue()static StringlongestCommonPrefix(org.apache.commons.collections4.trie.PatriciaTrie<?> trie) It sucks that lcp is not part of the public trie api ...static StringlongestPrefixLookup(String lookup, boolean inclusive, SortedMap<String, ?> prefixes) For a given lookup string find a string in a sorted map that is the longest prefix of the lookup string.static voidvoidremoveSuperseded(String prefix) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aksw.commons.collector.domain.Accumulator
accumulate
-
Field Details
-
prefixes
-
targetSize
protected int targetSize -
pattern
-
-
Constructor Details
-
PrefixAccumulator
public PrefixAccumulator(int targetSize)
-
-
Method Details
-
getValue
-
defaultGrouper
-
flatMapMapValues
-
commonPrefix
Returns the common prefix of the given strings- Returns:
-
longestPrefixLookup
public static String longestPrefixLookup(String lookup, boolean inclusive, SortedMap<String, ?> prefixes) For a given lookup string find a string in a sorted map that is the longest prefix of the lookup string. There is a suggestion for longest common prefix match could be performed efficiently: https://github.com/rkapsi/patricia-trie/issues/5- Parameters:
lookup-inclusive-prefixes-- Returns:
-
longestCommonPrefix
It sucks that lcp is not part of the public trie api ...- Parameters:
trie-- Returns:
-
removeSuperseded
-
accumulate
-
main
-