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

Added support for decade in hindi #986

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions dateparser/data/date_translation_data/hi.py
Expand Up @@ -162,6 +162,12 @@
],
"2 day ago": [
"परसों"
],
"1 decade ago": [
"पिछला दशक"
],
"in 1 decade": [
"अगला दशक"
]
},
"relative-type-regex": {
Expand Down Expand Up @@ -212,6 +218,12 @@
],
"in \\1 year": [
"(\\d+[.,]?\\d*) वर्ष में"
],
"in \\1 decade": [
"(\\d+[.,]?\\d*) दशक में"
],
"\\1 decade ago": [
"(\\d+[.,]?\\d*) दशक पहले"
]
},
"locale_specific": {},
Expand All @@ -235,6 +247,9 @@
","
],
"sentence_splitter_group": 3,
"decade": [
"दशक"
],
"ago": [
"पहले",
"पूर्व"
Expand Down
Expand Up @@ -10,6 +10,8 @@ november:
- नवम्बर
december:
- दिसम्बर
decade:
- दशक

year:
- साल
Expand All @@ -33,3 +35,15 @@ in:
relative-type:
2 day ago:
- परसों
1 decade ago:
- पिछला दशक
in 1 decade:
- अगला दशक

relative-type-regex:
in \1 decade:
- (\d+[.,]?\d*) दशक में
\1 decade ago:
- (\d+[.,]?\d*) दशक पहले


4 changes: 4 additions & 0 deletions tests/test_freshness_date_parser.py
Expand Up @@ -358,6 +358,8 @@ def test_relative_past_dates_with_time_as_period(self, date_string, ago, period)
param('1 वर्ष, 8 महीने, 2 सप्ताह', ago={'years': 1, 'months': 8, 'weeks': 2}, period='week'),
param('1 वर्ष 7 महीने', ago={'years': 1, 'months': 7}, period='month'),
param('आज', ago={'days': 0}, period='day'),
param('1 दशक', ago={'years': 10}, period='year'),
param('1 दशक पहले', ago={'years': 10}, period='year'),

# af
param("2 uur gelede", ago={'hours': 2}, period='day'),
Expand Down Expand Up @@ -852,6 +854,7 @@ def test_relative_past_dates(self, date_string, ago, period):
param('1 वर्ष, 8 महीने, 2 सप्ताह', ago={'years': 1, 'months': 8, 'weeks': 2}, period='week'),
param('1 वर्ष 7 महीने', ago={'years': 1, 'months': 7}, period='month'),
param('आज', ago={'days': 0}, period='day'),
param('1 दशक पहले', ago={'years': 10}, period='year'),

# af
param("2 uur gelede", ago={'hours': 2}, period='day'),
Expand Down Expand Up @@ -1178,6 +1181,7 @@ def test_normalized_relative_dates(self, date_string, ago, period):
param('17 सेकंड बाद', in_future={'seconds': 17}, period='day'),
param('1 वर्ष, 5 महीने, 1 सप्ताह में',
in_future={'years': 1, 'months': 5, 'weeks': 1}, period='week'),
param('1 दशक में', in_future={'years': 10}, period='year'),

# af
param("oor 10 jaar", in_future={'years': 10}, period='year'),
Expand Down