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

Doesn't work with minutes? #22

Open
Daniyaldehleh opened this issue Mar 28, 2021 · 1 comment
Open

Doesn't work with minutes? #22

Daniyaldehleh opened this issue Mar 28, 2021 · 1 comment

Comments

@Daniyaldehleh
Copy link

Daniyaldehleh commented Mar 28, 2021

Hi All!
Despite the relatively low number of stars, I think this is the best DateTime NLP out there so kudos!

I think it can really shine itself if supports minutes too to make it more flexible. As currently:

Input:

print(timefhuman('2 hours and 30 minutes'))

output:

2021-03-28 02:00:00

Or

Input:

print(timefhuman('30 minutes'))

Output:

Traceback (most recent call last):
  File "/Users/Daniyal/Desktop/Test/test.py", line 3, in <module>
    print(timefhuman('30 minutes'))
  File "/Users/Daniyal/opt/anaconda3/lib/python3.8/site-packages/timefhuman/main.py", line 58, in timefhuman
    tokens = timefhuman_tokens(string, now)
  File "/Users/Daniyal/opt/anaconda3/lib/python3.8/site-packages/timefhuman/main.py", line 75, in timefhuman_tokens
    tokens = categorize(tokens, now)
  File "/Users/Daniyal/opt/anaconda3/lib/python3.8/site-packages/timefhuman/categorize.py", line 36, in categorize
    tokens = substitute_hour_minute_in_remaining(tokens, now)
  File "/Users/Daniyal/opt/anaconda3/lib/python3.8/site-packages/timefhuman/categorize.py", line 382, in substitute_hour_minute_in_remaining
    time_token = extract_hour_minute(token)
  File "/Users/Daniyal/opt/anaconda3/lib/python3.8/site-packages/timefhuman/categorize.py", line 316, in extract_hour_minute
    return TimeToken(relative_hour=hour, minute=minute, time_of_day=time_of_day)
  File "/Users/Daniyal/opt/anaconda3/lib/python3.8/site-packages/timefhuman/data.py", line 297, in __init__
    assert 0 <= self.hour < 24
AssertionError

and

Input:

print(timefhuman('One and half hour')) or even print(timefhuman('One hour'))

Output:

[]

@rnv812
Copy link

rnv812 commented Aug 20, 2024

I really need this feature too. Is this project abandoned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants