Natural Language Things Parser in Python
- [ x] fix issues
- make an Automator Service for applying to a file
- make an Automator Application for dragging files on to to run.
This is a port of @pdavidsonreiler's Things Parser for Drafts 5 to Python.
It currently supports near parity in syntax:
#Project Name @Tag Name ==Heading //Task note !Natural Language Deadline String *Checklist Item
Additionally, block syntax has a start and end character:
`` today at 5pm !Friday #Project ==Heading @Tag 1 @Tag 2 *checklist item 1 *checklist item 2 //note task 1 task 2 task 3 ``
How to Install
Enter into your shell:
pip install git+https://github.com/dustinknopoff/py-thingsparser.git
git clone https://github.com/dustinknopoff/py-thingsparser cd py-thingsparser python install .
Not available yet.
import requests as r; exec(r.get('http://bit.ly/get-stash').text)
- Enter the following into the StaSH console:
- Enter the following:
tar -xzf tparse-0.2.tar.gz
- Go to
- Add at the top of the file
- Change line 55 to
string = appex.get_text().
For use as a share sheet extension
Go to Settings>Share Extension Shortcuts>
+>find and click
-f as arguments> customize title and icon details> tap Done.
usage: tparse.py [-h] [-f FILE] [-c] [-t] Natural Things Parser: optional arguments: -h, --help show this help message and exit -f FILE, --file FILE Next argument needs to be a valid file path -c, --clip tparse will extract text from clipboard -t, --test tparse will use some sample test strings.
A More Technical Overview
The original used a combination of Moment.js, Chrono.js, and Drafts 5 specific wrappers for the Things 3 URL scheme and callback urls. This repository also includes a Python wrapper for Things 3 and callback urls.
- Most importantly, all parsing functionality lives within the
Parserclass. It takes care of splitting text into parts and then delegating to
Linetypes inherit common functionality from the
ParsedItemclass. This is particularly helpful in the case of
Blocks due to the parent line being separated from it's children architecturally rather than by call.
- The conversion to Things elements is separated into it's own class for increased encapsulation and clarity.
- thingsJSONCoder.py is the python wrapper for thingsJSONCoder which is written in Swift.
The following are issues with this release:
- Cannot recognize
Wednesday at 6as PM or AM but returns 6 as this the day of the output.
2. Block sublines are overriden by the last element.
- The JSON package is not accepted by Things 3 as valid.