Class XCoord
java.lang.Object
org.opensextant.extractors.flexpat.AbstractFlexPat
org.opensextant.extractors.xcoord.XCoord
- All Implemented Interfaces:
Extractor
Use this XCoord class for both test and development of patterns, as well as
to extract coordinates at runtime.
- Author:
- ubaldino
-
Field Summary
Fields inherited from class org.opensextant.extractors.flexpat.AbstractFlexPat
debug, log, match_width, patterns, patterns_file
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected RegexPatternManager
Create a pattern manager given the input stream and the file name.void
void
Support the standard Extractor interface.Support the standard Extractor interface.extract_coordinates
(String text, String text_id) Assess all enabled patterns against the given text.extract_coordinates
(String text, String text_id, int family) Limit the extraction to a particular family of coordinates.getName()
Extractor interface: getNamestatic boolean
void
match_DD
(boolean flag) Enable matching of DD patternsvoid
match_DM
(boolean flag) Enable matching of DM patternsvoid
match_DMS
(boolean flag) Enable matching of DMS patternsvoid
match_MGRS
(boolean flag) Enable matching of MGRS patternsvoid
match_UTM
(boolean flag) Enable matching of UTM patternsstatic void
setStrictMode
(boolean b) Methods inherited from class org.opensextant.extractors.flexpat.AbstractFlexPat
cleanup, configure, configure, configure, configure, getPatternManager, set_match_id, setMatchWidth
-
Field Details
-
RUNTIME_FLAGS
public static long RUNTIME_FLAGSReserved. This is a bit mask for caller to use. DEFAULTS: (a) enable all false-positive filters for coordinate types; (b) extract context around coordinate. -
DEFAULT_XCOORD_CFG
- See Also:
-
-
Constructor Details
-
XCoord
public XCoord(boolean debugmode) Debugging constructor -- if debugmode = True, enable debugging else if log4j debug mode is enabled, respect that.- Parameters:
debugmode
-
-
XCoord
public XCoord()Default constructor, debugging off.
-
-
Method Details
-
getName
Extractor interface: getName- Returns:
- name of extractor
-
createPatternManager
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:
IOException
- Signals that an I/O exception has occurred.
-
extract
Support the standard Extractor interface. This provides access to the most common extraction;- Parameters:
input
- text input- Returns:
- the list of matches
-
extract
Support the standard Extractor interface. This provides access to the most common extraction;- Parameters:
input_buf
- text- Returns:
- the list of matches
-
setStrictMode
public static void setStrictMode(boolean b) -
getStrictMode
public static boolean getStrictMode() -
enableAll
public void enableAll()- Overrides:
enableAll
in classAbstractFlexPat
-
disableAll
public void disableAll()- Overrides:
disableAll
in classAbstractFlexPat
-
match_DMS
public void match_DMS(boolean flag) Enable matching of DMS patterns- Parameters:
flag
- on/off
-
match_DM
public void match_DM(boolean flag) Enable matching of DM patterns- Parameters:
flag
- on/off
-
match_DD
public void match_DD(boolean flag) Enable matching of DD patterns- Parameters:
flag
- on/off
-
match_MGRS
public void match_MGRS(boolean flag) Enable matching of MGRS patterns- Parameters:
flag
- on/off
-
match_UTM
public void match_UTM(boolean flag) Enable matching of UTM patterns- Parameters:
flag
- on/off
-
extract_coordinates
Assess all enabled patterns against the given text. Resulting TextMatch objects carry both the original text ID and their own match ID- Parameters:
text
- text to match againsttext_id
- identifier for text.- Returns:
-
extract_coordinates
Limit the extraction to a particular family of coordinates. Diagnostic messages appear in TextMatchResultSet only when debug = ON.- Parameters:
text
- text to matchtext_id
- id for textfamily
- pattern family or XConstants.ALL_PATTERNS- Returns:
- TextMatchResultSet result set. If input is null, result set is null
-