Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

De improvement #1058

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 60 additions & 19 deletions dateparser/data/date_translation_data/de.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
],
"september": [
"sep",
"september"
"september",
"Sept"
],
"october": [
"okt",
Expand All @@ -53,38 +54,31 @@
],
"monday": [
"mo",
"montag",
"Mon"
"montag"
],
"tuesday": [
"di",
"dienstag",
"Die"
"dienstag"
],
"wednesday": [
"mi",
"mittwoch",
"Mit"
"mittwoch"
],
"thursday": [
"do",
"donnerstag",
"Don"
"donnerstag"
],
"friday": [
"fr",
"freitag",
"Fre"
"freitag"
],
"saturday": [
"sa",
"samstag",
"Sam"
"samstag"
],
"sunday": [
"so",
"sonntag",
"Son"
"sonntag"
],
"am": [
"vorm"
Expand Down Expand Up @@ -152,16 +146,23 @@
"dieses jahr"
],
"1 day ago": [
"gestern"
"gestern",
"am vortag"
],
"1 month ago": [
"letzten monat"
"letzten monat",
"vorherigen Monat",
"vor einem Monat"
],
"1 week ago": [
"letzte woche"
"letzte woche",
"vorherige Woche",
"vor einer woche"
],
"1 year ago": [
"letztes jahr"
"letztes jahr",
"vor einem Jahr",
"vorheriges Jahr"
],
"in 1 day": [
"morgen"
Expand Down Expand Up @@ -288,6 +289,7 @@
"uhr",
"um",
"und",
"am",
" ",
"'",
",",
Expand Down Expand Up @@ -319,38 +321,77 @@
{
"ein": "1"
},
{
"eins": "1"
},
{
"ersten": "1"
},
{
"zwei": "2"
},
{
"zweiten": "2"
},
{
"drei": "3"
},
{
"dritten": "3"
},
{
"vier": "4"
},
{
"vierten": "4"
},
{
"fünf": "5"
},
{
"fünften": "5"
},
{
"sechs": "6"
},
{
"sechsten": "6"
},
{
"sieben": "7"
},
{
"siebten": "7"
},
{
"acht": "8"
},
{
"achten": "8"
},
{
"neun": "9"
},
{
"neunten": "9"
},
{
"zehn": "10"
},
{
"zehnten": "10"
},
{
"elf": "11"
},
{
"elften": "11"
},
{
"zwölf": "12"
},
{
"zwölften": "12"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
skip: ["etwa", "uhr", "um", "und"]
skip: ["etwa", "uhr", "um", "und", "am"]

sentence_splitter_group : 1

monday:
- Mon
tuesday:
- Die
wednesday:
- Mit
thursday:
- Don
friday:
- Fre
saturday:
- Sam
sunday:
- Son

january:
- Jänner
february:
- Feber
march:
- Mrz
september:
- Sept

year:
- Jahre
Expand All @@ -49,10 +36,21 @@ in:
- im

relative-type:
1 day ago:
- am vortag
2 day ago:
- vorgestern
in 2 day:
- übermorgen
1 month ago:
- vorherigen Monat
- vor einem Monat
1 week ago:
- vorherige Woche
- vor einer woche
1 year ago:
- vor einem Jahr
- vorheriges Jahr

relative-type-regex:
\1 hour ago:
Expand All @@ -66,14 +64,28 @@ simplifications:
- einer: '1'
- einem: '1'
- ein: '1'
- eins: '1'
- ersten: '1'
- zwei: '2'
- zweiten: '2'
- drei: '3'
- dritten: '3'
- vier: '4'
- vierten: '4'
- fünf: '5'
- fünften : '5'
- sechs: '6'
- sechsten: '6'
- sieben: '7'
- siebten: '7'
- acht: '8'
- achten: '8'
- neun: '9'
- neunten: '9'
- zehn: '10'
- zehnten: '10'
- elf: '11'
- elften: '11'
- zwölf: '12'
- zwölften: '12'

5 changes: 5 additions & 0 deletions tests/test_languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,11 @@ def test_translation(self, shortname, datetime_string, expected_translation):
param('de', "vor 3 Stunden", "3 hour ago"),
param('de', "vor 2 Monaten", "2 month ago"),
param('de', "vor 2 Monaten, 2 Wochen", "2 month ago 2 week"),
param('de', "4 Sept 2022", "4 september 2022"),
param('de', "am Vortag", "1 day ago"),
param('de', "vorherigen Monat", "1 month ago"),
param('de', "vor einem Monat", "1 month ago"),
param('de', "Ersten Dezember 2022", "1 december 2022"),
# French
param('fr', "avant-hier", "2 day ago"),
param('fr', "hier", "1 day ago"),
Expand Down
3 changes: 1 addition & 2 deletions tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ def test_search_date_string(self, shortname, datetime_string):
# German
param('de', 'Die UdSSR blieb gemäß dem Neutralitätspakt '
'vom 13. April 1941 gegenüber Japan vorerst neutral.',
[('Die', datetime.datetime(1999, 12, 28, 0, 0)),
('13. April 1941', datetime.datetime(1941, 4, 13, 0, 0))],
[('13. April 1941', datetime.datetime(1941, 4, 13, 0, 0))],
settings={'RELATIVE_BASE': datetime.datetime(2000, 1, 1)}),

# Indonesian
Expand Down