Class RegexExtractor

  • All Implemented Interfaces:
    Extractor

    public class RegexExtractor
    extends Object
    implements Extractor
    An Extractor implementation that searches for a given regular expression pattern in the document.
    • Constructor Detail

      • RegexExtractor

        public RegexExtractor​(@NonNull
                              @NonNull Pattern pattern,
                              boolean fuzzyMatch)
        Instantiates a new RegexExtractor.
        Parameters:
        pattern - the pattern to search for
        fuzzyMatch - True - allow sub-word matching (i.e. "is" will be matched in "This"), False must match full spans of text.
      • RegexExtractor

        public RegexExtractor​(@NonNull
                              @NonNull String pattern,
                              boolean caseSensitive,
                              boolean fuzzyMatch)
        Instantiates a new RegexExtractor.
        Parameters:
        pattern - the pattern to search for
        caseSensitive - True - must match case, False - case does not matter
        fuzzyMatch - True - allow sub-word matching (i.e. "is" will be matched in "This"), False must match full spans of text.
      • RegexExtractor

        public RegexExtractor​(@NonNull
                              @NonNull String pattern,
                              boolean fuzzyMatch)
        Instantiates a new RegexExtractor.
        Parameters:
        pattern - the pattern to search for
        fuzzyMatch - True - allow sub-word matching (i.e. "is" will be matched in "This"), False must match full spans of text.
    • Method Detail

      • extract

        public Extraction extract​(@NonNull
                                  @NonNull HString hString)
        Description copied from interface: Extractor
        Generate an Extraction from the given HString.
        Specified by:
        extract in interface Extractor
        Parameters:
        hString - the source text from which we will generate an Extraction
        Returns:
        the Extraction