From d9d6a4b2d102240f583dcf9e18e4c7483908aacc Mon Sep 17 00:00:00 2001 From: mats Date: Tue, 14 Mar 2017 10:39:52 +0100 Subject: [PATCH 1/7] first add of sv language --- .gitignore | 2 + data/languagefiles/sv.yaml | 112 +++++++++++++++++++++++++++++++++++++ data/languages.yaml | 3 +- 3 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 data/languagefiles/sv.yaml diff --git a/.gitignore b/.gitignore index 61a5ad28f..a2a1e12a6 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,5 @@ docs/_build # Vim temp files *.swp + +.idea diff --git a/data/languagefiles/sv.yaml b/data/languagefiles/sv.yaml new file mode 100644 index 000000000..95b587fbf --- /dev/null +++ b/data/languagefiles/sv.yaml @@ -0,0 +1,112 @@ +name: Swedish + +dateorder: YMD + +skip: ["på", "den"] + +monday: + - Mån + - Månd + - Måndag +tuesday: + - Tis + - Tisdag + - Tisd +wednesday: + - Ons + - Onsdag + - Onsd +thursday: + - Tors + - Torsdag + - Torsd +friday: + - Fre + - Fredag + - Fred +saturday: + - Lör + - Lördag + - Lörd +sunday: + - Sön + - Söndag + - Sönd + +january: + - Jan + - Januari +february: + - Feb + - Februari +march: + - Mar + - Mars +april: + - Apr + - April +may: + - Maj +june: + - Jun + - Juni +july: + - Jul + - Juli +august: + - Aug + - Augusti +september: + - Sep + - Sept + - September +october: + - Okt + - Oktober +november: + - Nov + - November +december: + - Dec + - December + +year: + - år +month: + - månad + - månader +week: + - vecka + - veckor +day: + - dag + - dagar +hour: + - h + - timme + - timmar + - t +minute: + - m + - minut + - minuter +second: + - s + - sekund + - sekunder + +ago: + - sedan +in: + - om + - från nu + +simplifications: + - förrgår: 2 dagar + - igår: 1 dag + - imorgon: om 1 dag + - idag: 0 dagar + - förra (veckan|månaden|året): 1 \1 + - nästa (vecka|månad|år): om 1 \1 + - en: 1 + - två: 2 diff --git a/data/languages.yaml b/data/languages.yaml index 0344d0c3c..0b9b8f5f1 100644 --- a/data/languages.yaml +++ b/data/languages.yaml @@ -1,7 +1,7 @@ base: skip: [" ", ".", ",", ";", "-", "/", "'", "|", "@", "[", "]", ","] -languageorder: ['en', 'ar', 'be', 'bg', 'bn', 'cs', 'da', 'de', 'es', 'fa', 'fi', 'fr', 'he', 'hi', 'hu', 'id', 'it', 'ja', 'nl', 'pl', 'pt', 'ro', 'ru', 'th', 'tl', 'tr', 'uk', 'vi', 'zh'] +languageorder: ['en', 'ar', 'be', 'bg', 'bn', 'cs', 'da', 'de', 'es', 'fa', 'fi', 'fr', 'he', 'hi', 'hu', 'id', 'it', 'ja', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv', 'th', 'tl', 'tr', 'uk', 'vi', 'zh'] ar: !include languagefiles/ar.yaml be: !include languagefiles/be.yaml @@ -26,6 +26,7 @@ pl: !include languagefiles/pl.yaml pt: !include languagefiles/pt.yaml ro: !include languagefiles/ro.yaml ru: !include languagefiles/ru.yaml +sv: !include languagefiles/sv.yaml th: !include languagefiles/th.yaml tl: !include languagefiles/tl.yaml tr: !include languagefiles/tr.yaml From 00d8d78235ba8d7510a83c13df39d65e00669556 Mon Sep 17 00:00:00 2001 From: mats Date: Tue, 14 Mar 2017 14:22:48 +0100 Subject: [PATCH 2/7] tested sv language --- data/languagefiles/sv.yaml | 1 + tests/test_languages.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/data/languagefiles/sv.yaml b/data/languagefiles/sv.yaml index 95b587fbf..646a79e75 100644 --- a/data/languagefiles/sv.yaml +++ b/data/languagefiles/sv.yaml @@ -75,6 +75,7 @@ year: month: - månad - månader + - månaden week: - vecka - veckor diff --git a/tests/test_languages.py b/tests/test_languages.py index 240aa9542..17020c73d 100644 --- a/tests/test_languages.py +++ b/tests/test_languages.py @@ -174,11 +174,15 @@ def setUp(self): # Bangla param('bn', "সেপ্টেম্বর 03 2014", "september 03 2014"), param('bn', "শুক্রবার, 03 সেপ্টেম্বর 2014", "friday 03 september 2014"), - + #Hindi param('hi', 'सोमवार 13 जून 1998','monday 13 june 1998'), param('hi', 'मंगल 16 1786 12:18','tuesday 16 1786 12:18'), param('hi','शनि 11 अप्रैल 2002 03:09','saturday 11 april 2002 03:09'), + + # Swedish + param('sv', "Sept 03 2014", "september 03 2014"), + param('sv', "fredag, 03 september 2014", "friday 03 september 2014"), ]) def test_translation(self, shortname, datetime_string, expected_translation): self.given_bundled_language(shortname) @@ -407,6 +411,13 @@ def test_translation(self, shortname, datetime_string, expected_translation): param('hi', "सन् १९२०"," 1920"), param('hi',"आठ पूर्वाह्न","8 am"), param('hi',"बारह सेकंड पूर्व","12 second ago"), + # Swedish + param('sv', "igår", "1 day"), + param('sv', "idag", "0 day"), + param('sv', "förrgår", "2 day"), + param('sv', "förra månaden", "1 month"), + param('sv', "nästa månad", "in 1 month"), + ]) def test_freshness_translation(self, shortname, datetime_string, expected_translation): # Finnish language use "t" as hour, so empty SKIP_TOKENS. From fc764ac7438a1778eec3985d4a1008f84a798ffe Mon Sep 17 00:00:00 2001 From: Mats Gustafsson Date: Thu, 6 Apr 2017 09:55:46 +0200 Subject: [PATCH 3/7] upd revision number --- dateparser/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dateparser/__init__.py b/dateparser/__init__.py index ca43301ae..604f3a550 100644 --- a/dateparser/__init__.py +++ b/dateparser/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -__version__ = '0.6.0' +__version__ = '0.7.0.dev1' from .date import DateDataParser from .conf import apply_settings From 3888c0f2aef47666c23d2544ba23cb0e070e4506 Mon Sep 17 00:00:00 2001 From: mats Date: Mon, 10 Apr 2017 16:47:13 +0200 Subject: [PATCH 4/7] add swedish language --- tests/test_languages.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_languages.py b/tests/test_languages.py index 17020c73d..0b5350d0a 100644 --- a/tests/test_languages.py +++ b/tests/test_languages.py @@ -10,7 +10,6 @@ from tests import BaseTestCase - class TestBundledLanguages(BaseTestCase): def setUp(self): super(TestBundledLanguages, self).setUp() From 87f17f53167d280a6d1cff32e8dddce99dd85d30 Mon Sep 17 00:00:00 2001 From: Mats Gustafsson Date: Tue, 16 May 2017 07:36:14 +0200 Subject: [PATCH 5/7] Reverted --- dateparser/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dateparser/__init__.py b/dateparser/__init__.py index 604f3a550..ca43301ae 100644 --- a/dateparser/__init__.py +++ b/dateparser/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -__version__ = '0.7.0.dev1' +__version__ = '0.6.0' from .date import DateDataParser from .conf import apply_settings From 58c8ffcbc527d9c861404fae5bb152302ee17edc Mon Sep 17 00:00:00 2001 From: Mats Gustafsson Date: Tue, 16 May 2017 07:37:12 +0200 Subject: [PATCH 6/7] Updated --- tests/test_languages.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_languages.py b/tests/test_languages.py index 0b5350d0a..17020c73d 100644 --- a/tests/test_languages.py +++ b/tests/test_languages.py @@ -10,6 +10,7 @@ from tests import BaseTestCase + class TestBundledLanguages(BaseTestCase): def setUp(self): super(TestBundledLanguages, self).setUp() From fba5e1db40f96cd55148ca35b0662413ddfe1ab8 Mon Sep 17 00:00:00 2001 From: Waqas Shabir Date: Sun, 21 May 2017 17:10:17 -0400 Subject: [PATCH 7/7] Add swedish to supported langs in README --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 922e81649..a4692479d 100644 --- a/README.rst +++ b/README.rst @@ -265,6 +265,7 @@ Supported languages * Romanian * Russian * Spanish +* Swedish * Thai * Turkish * Ukrainian