Class FuzzyPattern


  • public class FuzzyPattern
    extends Object

    Fuzzy pattern matcher. Sample string matched if:

    1. Sample string contains pattern string as a simple substring.
    2. All pattern words are prefixes of corresponding sample words.
    3. Pattern may be split into words that all matches prefixes of sample words.

    For example, given the pattern "foo123bar", the pattern words are: foo, 123, bar.

    Following samples are matched: FooBar123, FoobuzBarbuz12345, 123 bar foo, B12Ar3foo.

    • Constructor Detail

      • FuzzyPattern

        public FuzzyPattern​(String pattern)
        Instantiates a new fuzzy pattern.
        Parameters:
        pattern - the pattern
    • Method Detail

      • match

        public FuzzyPattern.Match match​(String sample,
                                        boolean useMutation)
        Matches the sample.
        Parameters:
        sample - sample to match.
        useMutation - use mutation (splitting) of pattern
        Returns:
        FuzzyPattern.Match.NONE if sample not matched, FuzzyPattern.Match describing the match otherwise.