Skip to content

Commit 93b5015

Browse files
committed
Reject ranges with units as a lat/long
1 parent 31d8b2d commit 93b5015

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "traiter"
7-
version = "2.2.2"
7+
version = "2.2.3"
88
description = "Rule-based parsers for mining text from research sources"
99
readme = "README.md"
1010
license = {file = "LICENSE"}

traiter/pylib/rules/lat_long.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ def pipe(cls, nlp: Language):
6868
overwrite=["lat_long"],
6969
compiler=cls.lat_long_plus_patterns(),
7070
)
71-
# add.debug_tokens(nlp) # #############################################
7271
add.cleanup_pipe(nlp, name="lat_long_cleanup")
7372

7473
@classmethod
@@ -81,7 +80,6 @@ def lat_long_patterns(cls):
8180
"-": {"TEXT": {"IN": const.DASH}},
8281
"'s": {"LOWER": "'s"},
8382
"99": {"LOWER": {"REGEX": r"^\d{1,2}$"}},
84-
"9999": {"LOWER": {"REGEX": r"^\d+$"}},
8583
"99.0": {"TEXT": {"REGEX": rf"^{cls.float_ll}$"}},
8684
"99.99": {"TEXT": {"REGEX": r"^\d+\.\d{2,}$"}},
8785
"[+]": {"TEXT": {"REGEX": cls.plus}},
@@ -102,6 +100,14 @@ def lat_long_patterns(cls):
102100
}
103101

104102
return [
103+
Compiler(
104+
label="not_lat_long",
105+
decoder=decoder,
106+
on_match=reject_match.REJECT_MATCH,
107+
patterns=[
108+
" 99.0 - 99.0 m ",
109+
],
110+
),
105111
Compiler(
106112
label="lat_long",
107113
on_match="lat_long_match",

0 commit comments

Comments
 (0)