Create dates from natural language expressions
Project description
stringtime
A grammar for deriving Date objects from phrases.
api currently looks something like this...
from stringtime import Date
somedate = Date.from_phrase('an hour from now')
but is early days so will probably eventually parse via the Date constructor and on fail pass along to the regular dateutil parser.
Installation
python3 -m pip install stringtime
Usage and API
Here's a list of example phrases that can be used...
"an hour from now"
"1 hour from now"
"1 hour ago"
"Today"
"Yesterday"
"Tomorrow"
"Tuesday"
"On Wednesday"
"This Friday at 1"
"Last Wednesday at 5"
to see what else check the unit tests.
... more to come.
CLI
There's several commands you can pass to sharpshooter on the command line.
stringtime -p 2 days frome now
Tests
make test
License
Do what you want with this code.
Uses David Beazley's PLY parser.
Disclaimer
Might be buggy... only just made it yesterday.
Probs ignore this til at least version 0.3.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stringtime-0.0.1.tar.gz
(13.4 kB
view hashes)
Built Distribution
stringtime-0.0.1-py3-none-any.whl
(13.3 kB
view hashes)
Close
Hashes for stringtime-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d2771a615747c2d806536e7e9c2347d0423935aec813629aab9c15adde6e8b0 |
|
MD5 | d33f0390388df7b3546348145f1846da |
|
BLAKE2b-256 | 86db03bc2f25b96b9ec26c43c153b7e433c5f5672bed8fa9b63e16c3d2dd6395 |