DEV Community

Cover image for Tense - Time Processing Tool (Refactored)
DenyS
DenyS

Posted on

Tense - Time Processing Tool (Refactored)

Tense 1.0.0b release!
https://github.com/Animatea/tense

What's new?
aiotense -> tense

  • The project is completely redone and optimized for parsing.

By refactoring the project, we got a ~x22.31 speedup in processing complex strings (using smart_resolver).
-> Was: ~0.00095030...μs | Now: ~0.00004260...μs

And ~x38.28 speed up processing simple strings (using basic_resolver).
-> Was: ~0.00062400...μs | Now: ~0.00001630...μs

Documentation here:
https://animatea.github.io/tense/

Not familiar with the project yet?
tense - flexible time parsing tool.
Use existing functionality, create your own!

  • Create your own converters
  • Add your own units of time
  • Create your own parsers

Coming soon:

  • Add your aliases to the numbers!

Simple example:

from tense import TenseParser

time_string = "1d2minutes 5 sec"

digit_parser = TenseParser(TenseParser.DIGIT)
assert digit_parser.parse(time_string) == 86525
Enter fullscreen mode Exit fullscreen mode

For more information see GitHub page!

Top comments (0)