Package org.opensextant.extractors.poli
Class PoliPatternManager
java.lang.Object
org.opensextant.extractors.flexpat.RegexPatternManager
org.opensextant.extractors.poli.PoliPatternManager
-
Field Summary
Fields inherited from class org.opensextant.extractors.flexpat.RegexPatternManager
debug, log, patternFile, patterns, patterns_list, testcases, testing
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.logic for creation of a match is back in main PoLi match loopprotected RegexPattern
create_pattern
(String fam, String rule, String desc) Pattern Factory Implementation must create a RegexPattern given the basic RULE define, #RULE FAMILY RID REGEX PatternManager here adds compiled pattern and DEFINES.protected PatternTestCase
create_testcase
(String id, String fam, String text) Implementation must create TestCases given the #TEST directive, #TEST RID TID TEXTvoid
disable_patterns
(String fam) Enable a family of patternsvoid
enable_pattern
(RegexPattern repat) enable an instance of a pattern based on the global settings.void
enable_patterns
(String fam) default adapter -- you must override.void
You don't really want to enable All patterns...protected boolean
validate_pattern
(RegexPattern repat) Implementation has the option to check a pattern; For now invalid patterns are only logged.Methods inherited from class org.opensextant.extractors.flexpat.RegexPatternManager
disableAll, get_pattern, get_patterns, getConfigurationDebug, group_map, group_matches, initialize
-
Constructor Details
-
PoliPatternManager
- Throws:
IOException
-
-
Method Details
-
disable_patterns
Enable a family of patterns- Parameters:
fam
- pat family to disable
-
enableAll
public void enableAll()You don't really want to enable All patterns... unless you are brute force testing all your patterns.- Overrides:
enableAll
in classRegexPatternManager
-
enable_patterns
Description copied from class:RegexPatternManager
default adapter -- you must override. This should be abstract, but not all pattern managers are required to support this.- Overrides:
enable_patterns
in classRegexPatternManager
- Parameters:
fam
- pattern name to enable.
-
enable_pattern
enable an instance of a pattern based on the global settings.- Specified by:
enable_pattern
in classRegexPatternManager
- Parameters:
repat
- regex pattern
-
create_pattern
Pattern Factory Implementation must create a RegexPattern given the basic RULE define, #RULE FAMILY RID REGEX PatternManager here adds compiled pattern and DEFINES.- Specified by:
create_pattern
in classRegexPatternManager
- Parameters:
fam
- pattern familyrule
- pattern rule IDdesc
- optional description- Returns:
- flexpat pattern
-
validate_pattern
Implementation has the option to check a pattern; For now invalid patterns are only logged. All patterns in config file are valid. Override this as needed.- Specified by:
validate_pattern
in classRegexPatternManager
- Parameters:
repat
- pattern object- Returns:
- true if pattern is valid
-
create_testcase
Implementation must create TestCases given the #TEST directive, #TEST RID TID TEXT- Specified by:
create_testcase
in classRegexPatternManager
- Parameters:
id
- test IDtext
- text for testfam
- pattern family to test- Returns:
- test case
-
create_match
@Deprecated public PoliMatch create_match(String pattern_id, String matchtext, Map<String, String> groups) Deprecated.logic for creation of a match is back in main PoLi match loopThe match object is normalized, setting the coord_text and other data from parsing "text" and knowing which pattern family was matched.- Parameters:
pattern_id
- the pattern_idmatchtext
- the matchtextgroups
- the groups- Returns:
- the poli match
-