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

italian: support 'un ora fa', 'un'ora fa', 'oggi alle 11:00'. #1049

Open
wants to merge 1 commit 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
4 changes: 4 additions & 0 deletions dateparser/data/date_translation_data/it.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
"skip": [
"circa",
"e",
"alle",
" ",
"'",
",",
Expand All @@ -277,6 +278,9 @@
"simplifications": [
{
"(\\d+)\\s+ora": "\\1 ore"
},
{
"un[' ]ora": "1 ore"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
skip: ["circa", "e"]
skip: ["circa", "e", "alle"]

sentence_splitter_group : 1

Expand Down Expand Up @@ -28,3 +28,4 @@ relative-type:

simplifications:
- (\d+)\s+ora: \1 ore
- un[' ]ora: 1 ore
6 changes: 6 additions & 0 deletions tests/test_languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def setUp(self):
# Italian
param('it', "Giovedi Maggio 29 2013", "thursday may 29 2013"),
param('it', "19 Luglio 2013", "19 july 2013"),
param('it', "19 Luglio 2013", "19 july 2013"),

# Portuguese
param('pt', "22 de dezembro de 2014 às 02:38", "22 december 2014 02:38"),
# Russian
Expand Down Expand Up @@ -848,6 +850,10 @@ def test_translation(self, shortname, datetime_string, expected_translation):
param('it', "oggi", "0 day ago"),
param('it', "2 settimana fa", "2 week ago"),
param('it', "2 anno fa", "2 year ago"),
param('it', "un ora fa", "1 hour ago"),
param('it', "un'ora fa", "1 hour ago"),
param('it', "oggi alle 11:00", "0 day ago 11:00"),
param('it', "oggi 11:00", "0 day ago 11:00"),
# Portuguese
param('pt', "anteontem", "2 day ago"),
param('pt', "ontem", "1 day ago"),
Expand Down