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

Add feature to parse duration period #47

Open
mohammad-albarham opened this issue Oct 16, 2021 · 1 comment
Open

Add feature to parse duration period #47

mohammad-albarham opened this issue Oct 16, 2021 · 1 comment
Labels
feature request Feature request

Comments

@mohammad-albarham
Copy link
Collaborator

What problem are you trying to solve?

Parsing the duration from the text that has the difference between the two dates.

Examples (if relevant)

>>> from maha.parsers.functions import parse_dimension
>>> output = parse_dimension('عن ربع نمو سكان العالم القديم والتحضر بين 1700 و 1900 ميلادي', duration=True)[0].value
>>> output
DurationValue(values=[ValueUnit(value=200, unit=<DurationUnit.YEARS: 7>)], normalized_unit=<DurationUnit.SECONDS: 1>)

Definition of Done

  • It must adhere to the coding style used in the defined dimensions, duration dimension.
  • The implementation should cover most use cases.
  • Adding tests
@mohammad-albarham mohammad-albarham added the feature request Feature request label Oct 16, 2021
@TRoboto
Copy link
Owner

TRoboto commented Oct 16, 2021

This shouldn't return the difference, rather it would be better to return a new period object for the duration. Something similar to:

DurationPeriod(start=ValueUnit(value=1700, unit=<DurationUnit.YEARS: 7>), end=ValueUnit(value=1900, unit=<DurationUnit.YEARS: 7>))

@TRoboto TRoboto changed the title Add new case for duration dimension in parser Add new case for time dimension in parser Oct 17, 2021
@TRoboto TRoboto changed the title Add new case for time dimension in parser Add feature to parse duration period Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Feature request
Projects
None yet
Development

No branches or pull requests

2 participants