Skip to content

Commit

Permalink
Fix #373 capture single-quoted predicates > 1 char
Browse files Browse the repository at this point in the history
  • Loading branch information
goodmami committed Dec 12, 2023
1 parent 904d456 commit ec01639
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

* Stop using Python's undocumented parse_template re function ([#378])
* Resolved newline and encoding issues for running tests on Windows ([#379])
* Capture legacy single-quoted predicates longer than 1 character ([#373])


## [v1.8.1]
Expand Down Expand Up @@ -1620,6 +1621,7 @@ information about changes, except for
[#360]: https://github.com/delph-in/pydelphin/issues/360
[#364]: https://github.com/delph-in/pydelphin/issues/364
[#367]: https://github.com/delph-in/pydelphin/issues/367
[#373]: https://github.com/delph-in/pydelphin/issues/373
[#374]: https://github.com/delph-in/pydelphin/issues/374
[#375]: https://github.com/delph-in/pydelphin/issues/375
[#376]: https://github.com/delph-in/pydelphin/issues/376
Expand Down
2 changes: 1 addition & 1 deletion delphin/codecs/simplemrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def encode(m, properties=True, lnk=True, indent=False):
r'|@\d+'
r'|\d+(?: +\d+)*)>', 'LNK:a lnk value'),
(r'"([^"\\]*(?:\\.[^"\\]*)*)"', 'DQSTRING:a string'),
(r"'([^ \n:<>\[\]])", 'SQSYMBOL:a quoted symbol'),
(r"'([^ \n:<>\[\]]+)", 'SQSYMBOL:a quoted symbol'),
(r'_[^\s_]+' # lemma
r'_[nvajrscpqxud]' # pos
r'(?:_(?:[^\s_<]|<(?![-0-9:#@ ]*>\s))+)?' # optional sense
Expand Down
6 changes: 6 additions & 0 deletions tests/codecs/simplemrs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,9 @@ def test_escapes_issue_367():
m2 = simplemrs.decode(s)
assert m == m2
assert m.surface == m2.surface


def test_legacy_single_quote_predicates_issue_373():
# https://github.com/delph-in/pydelphin/issues/373
m = simplemrs.decode("[ RELS: < [ 'single+quoted LBL: h0 ] > ]")
assert m.rels[0].predicate == "single+quoted"

0 comments on commit ec01639

Please sign in to comment.