Improved relative parsing for dates

Aperta
#871 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Inizia con gli esempi di dateparser.parse nell’issue e riproduci i risultati riportati per frasi relative come "1st day of next month" e "1st Friday of next month". Segui il percorso di parsing relativo e aggiungi la copertura per le date attese indicate; il lavoro sarà completato quando queste frasi restituiranno le date descritte nel report senza compromettere le impostazioni mostrate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Type: Enhancement

Would like to see more improved relative date parsing for things like "first day of next week" or "3rd Friday of next month". I tried a few combos, but it doesn't seem like what does get returned isn't correct or is nothing. Still learning and trying to understand the settings, etc.

# Date these commands were tried
>>> datetime.now()
datetime.datetime(2021, 1, 29, 12, 11, 5, 767319)

# Should be 2021/2/1
>>> dateparser.parse("1st day of next month")
datetime.datetime(2021, 3, 1, 11, 45, 25, 946280)
>>> dateparser.parse("1st day of next month", settings={"PARSERS": ["relative-time"], "PREFER_DATES_FROM": "future"})
datetime.datetime(2021, 3, 1, 12, 9, 46, 215356)

# Might be a bit ambiguous but probably should've been 2021/1/1
>>> dateparser.parse("1st day of month")
datetime.datetime(2021, 1, 28, 11, 46, 7, 6558)
>>> dateparser.parse("1st day of month", settings={"PARSERS": ["relative-time"], "PREFER_DATES_FROM": "future"})
datetime.datetime(2021, 1, 30, 12, 10, 26, 52697)

# Should be 2021/2/1
>>> dateparser.parse("1st day of next week")
datetime.datetime(2021, 2, 6, 12, 7, 0, 768280)
>>> dateparser.parse("1st day of next week", settings={"PARSERS": ["relative-time"], "PREFER_DATES_FROM": "future"})
datetime.datetime(2021, 2, 6, 12, 10, 48, 262064)

# Should be 2021/2/5
>>> dateparser.parse("1st Friday of next month")

>>> dateparser.parse("1st Friday of next month", settings={"PARSERS": ["relative-time"], "PREFER_DATES_FROM": "future"})

Lingua principale
Python
Stelle
2.9k
Fork
545
Merge medio
2g 4h
PR unite (30g)
17

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di scrapinghub/dateparser

Tutte le issue di scrapinghub/dateparser

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.