Skip to content

Commit 4010766

Browse files
committed
MGRS filters for time formats
1 parent e6827f7 commit 4010766

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/main/python/opensextant/extractors/xcoord.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ def __init__(self):
369369
GeocoordFilter.__init__(self)
370370
self.date_formats = ["DDMMMYYYY", "DMMMYYHHmm", "DDMMMYYHHmm", "DDMMMYY", "DMMMYY", "HHZZZYYYY"]
371371
self.sequences = ["1234", "123456", "12345678", "1234567890"]
372+
self.stop_terms = { "PER", "SEC", "UTC", "GMT", "GAL"}
372373
self.today = arrow.utcnow()
373374
self.YEAR = self.today.date().year
374375
self.YY = self.YEAR - 2000
@@ -391,9 +392,9 @@ def filter_out(self, mgrs: GeocoordMatch) -> tuple:
391392

392393
if not (mgrs.text.isupper() and len(mgrs.text.replace(" ", "")) > 6):
393394
return True, "lexical"
394-
parts = set(mgrs.text.split())
395-
if "SEC" in parts or "PER" in parts:
396-
return True, "rate"
395+
for term in self.stop_terms:
396+
if term in mgrs.textnorm:
397+
return True, "measure"
397398
for seq in self.sequences:
398399
if seq in mgrs.textnorm:
399400
return True, "digit-seq"

src/main/python/opensextant/resources/geocoord_patterns_py.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
#CLASS MGRS opensextant.extractors.xcoord.MGRSMatch
186186
#RULE MGRS 01 \b<MGRSZone>\s?<MGRSQuad>\s{0,2}<Easting_Northing>\b
187187
#TEST MGRS 01 4QFJ 50007000
188+
#TEST MGRS 01 Time of day 11:30 UTC 21 # FAIL - time component
188189
#TEST MGRS 01 38SMB4611036560
189190
#TEST MGRS 01 38SMB46113656
190191
#TEST MGRS 01 8SMB46113656

src/main/python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
setup(
1616
name='opensextant',
17-
version='1.6.6',
17+
version='1.6.7',
1818

1919
description='OpenSextant APIs and Utilities',
2020
long_description=long_description,

0 commit comments

Comments
 (0)