Improve parsing of nautral language string with punctuation
- Dominant language
- Python
- Stars
- 9.1k
- Forks
- 784
- PR merge metrics
- No merged PRs in 30d
Description
I don't think any number would work in my implementation but I can increase it to any finite number you want (say 2 or 3 punctuation marks). I think one is fine; more than two is probably overkill.
Edit: Maybe allow 3 or 4 due to the use of "...", although I'm not sure how often people use those after dates. I could see people using a date like this: He said, "The date is 1/2/13." So maybe increasing the constraint is actually a good idea, and I can increase it infinitely following the date, just not preceding it.
_Originally posted by @andrewchouman in https://github.com/crsmithdev/arrow/pull/720_
===========================================================
I tend to agree, but the only thing that concerns me is that this worked pre 0.15.0 (I chose 0.13.0 for example):
```shell
venv ❯ python3
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import arrow
>>> arrow.__version__
'0.13.0'
>>> arrow.get("This date has too many punctuation marks following it 11.11.2011", "DD.MM.YYYY")
>>> arrow.get("This date has too many punctuation marks following it (11.11.2011)", "DD.MM.YYYY")
>>> arrow.get("This date has too many punctuation marks following it (11.11.2011).", "DD.MM.YYYY")
```
This is definitely an improvement, but for full pre-0.15.0 behavior while still containing improvements, we probably need to add support for any number of punctuation marks. Curious, why would finite numbers work but not infinite (e.g. with the `+` quantifier in regex)?
_Originally posted by @jadchaar in https://github.com/crsmithdev/arrow/pull/720_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the documented examples through arrow.get with the DD.MM.YYYY format, then trace the date-string parsing path. Done means punctuation before and after the date is handled consistently with the described pre-0.15.0 behavior while retaining the newer parsing improvements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100