Package org.opensextant.extractors.poli
Class PatternsOfLife
- java.lang.Object
-
- org.opensextant.extractors.flexpat.AbstractFlexPat
-
- org.opensextant.extractors.poli.PatternsOfLife
-
- All Implemented Interfaces:
Extractor
public class PatternsOfLife extends AbstractFlexPat
- Author:
- Marc C. Ubaldino, MITRE, ubaldino at mitre dot org
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_POLI_CFG
-
Fields inherited from class org.opensextant.extractors.flexpat.AbstractFlexPat
debug, log, match_width, patterns, patterns_file
-
-
Constructor Summary
Constructors Constructor Description PatternsOfLife()
Default constructor, debugging off.PatternsOfLife(boolean debugmode)
-
Method Summary
Modifier and Type Method Description void
cleanup()
Extractor interface: extractors are responsible for cleaning up after themselves.protected RegexPatternManager
createPatternManager(java.io.InputStream s, java.lang.String n)
Create a pattern manager given the input stream and the file name.java.util.List<TextMatch>
extract(java.lang.String input_buf)
Useful for working with text buffers adhoc.java.util.List<TextMatch>
extract(TextInput input)
Support the standard Extractor interface.java.util.List<TextMatch>
extract(TextInput input, java.lang.String family)
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.java.lang.String
getName()
Extractor interface: getName-
Methods inherited from class org.opensextant.extractors.flexpat.AbstractFlexPat
configure, configure, configure, configure, disableAll, enableAll, getPatternManager, markComplete, set_match_id, setMatchWidth, updateProgress
-
-
-
-
Field Detail
-
DEFAULT_POLI_CFG
public static final java.lang.String DEFAULT_POLI_CFG
- See Also:
- Constant Field Values
-
-
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 classAbstractFlexPat
- Parameters:
s
- stream of patterns config filen
- 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(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 processtext_id
- - identifier for the datafamily
- - optional filter; to reuse the same PatManager but extract certain patterns only.- Returns:
- PoliResult
-
-