Skip to content
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
2 changes: 1 addition & 1 deletion dateparser/data/date_translation_data/fr.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@
"six": "6"
},
{
"sept": "7"
"sept(?=:\\d|\\s*(?:années|année|ans|an|semaines|semaine|sem|secondes|seconde|minutes|minute|min|mois|heures|heure|jours|jour|[jhms])\\b|\\s*a\\b(?!\\s*\\d))": "7"
},
{
"huit": "8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ simplifications:
- quatre: '4'
- cinq: '5'
- six: '6'
- sept: '7'
# 'sept' is both the abbreviation for 'septembre' and the word for 7,
# and simplifications run before month names are translated. Only
# simplify it to 7 where it is a quantity, i.e. followed by a duration
# unit or a clock time. 'a' (for 'annee') counts as a unit only when no
# number follows it, because the preposition 'a' loses its accent during
# normalization and introduces a time, as in '3 sept a 14h30'.
- 'sept(?=:\d|\s*(?:années|année|ans|an|semaines|semaine|sem|secondes|seconde|minutes|minute|min|mois|heures|heure|jours|jour|[jhms])\b|\s*a\b(?!\s*\d))': '7'
- huit: '8'
- neuf: '9'
- dix: '10'
Expand Down
12 changes: 12 additions & 0 deletions tests/test_languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ def setUp(self):
param("fr", "20 Février 2012", "20 february 2012"),
param("fr", "Mercredi 19 Novembre 2013", "wednesday 19 november 2013"),
param("fr", "18 octobre 2012 à 19 h 21 min", "18 october 2012 19:21"),
# "sept" is both the abbreviation for "septembre" and the word for
# 7, so it must only be simplified to a number where it is used as
# a quantity.
param("fr", "1 sept. 2024", "1 september. 2024"),
param("fr", "11 sept. 2014", "11 september. 2014"),
param("fr", "mardi 3 sept 2024", "tuesday 3 september 2024"),
param("fr", "3 sept à 14h30", "3 september 14:30"),
param("fr", "sept heures", "7 hour"),
param("fr", "il y a sept jours", "7 day ago"),
param("fr", "sept ans", "7 year"),
param("fr", "il y a sept a", "7 year ago"),
param("fr", "sept:30", "7:30"),
# German
param("de", "29. Juni 2007", "29. june 2007"),
param("de", "Montag 5 Januar, 2015", "monday 5 january 2015"),
Expand Down