Class PatternsOfLife

  • All Implemented Interfaces:
    Extractor

    public class PatternsOfLife
    extends AbstractFlexPat
    Author:
    Marc C. Ubaldino, MITRE, ubaldino at mitre dot org
    • Field Detail

      • DEFAULT_POLI_CFG

        public static final java.lang.String DEFAULT_POLI_CFG
        See Also:
        Constant Field Values
    • Constructor Detail

      • PatternsOfLife

        public PatternsOfLife​(boolean debugmode)
      • PatternsOfLife

        public PatternsOfLife()
        Default constructor, debugging off.
    • Method Detail

      • cleanup

        public void cleanup()
        Extractor interface: extractors are responsible for cleaning up after themselves.
      • getName

        public java.lang.String getName()
        Extractor interface: getName
        Returns:
        extractor name
      • createPatternManager

        protected RegexPatternManager createPatternManager​(java.io.InputStream s,
                                                           java.lang.String n)
                                                    throws java.io.IOException
        Description copied from class: AbstractFlexPat
        Create a pattern manager given the input stream and the file name.
        Specified by:
        createPatternManager in class AbstractFlexPat
        Parameters:
        s - stream of patterns config file
        n - app name
        Returns:
        the regex pattern manager
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • extract

        public java.util.List<TextMatch> extract​(TextInput input)
        Support the standard Extractor interface. This provides access to the most common extraction; For PoLi extraction, you would process ALL patterns in your configuration file, or if you enable only certain patterns -- those enabled at the time of this call would be executed. extract_patterns( family = null ) implies ALL patterns.
        Parameters:
        input - text input
        Returns:
        the list of TextMatch
      • extract

        public java.util.List<TextMatch> extract​(TextInput input,
                                                 java.lang.String family)
      • extract

        public java.util.List<TextMatch> extract​(java.lang.String input_buf)
        Description copied from interface: Extractor
        Useful for working with text buffers adhoc. Fewer assumptions about input data here.
        Parameters:
        input_buf - text input, as a string
        Returns:
        the list of TextMatch
      • extract_patterns

        public TextMatchResult extract_patterns​(java.lang.String text,
                                                java.lang.String text_id,
                                                java.lang.String family)
        Extract patterns of a certain family from a block of text.
        Parameters:
        text - - data to process
        text_id - - identifier for the data
        family - - optional filter; to reuse the same PatManager but extract certain patterns only.
        Returns:
        PoliResult