I'm very interested in the kinds of things you are talking about. I have a computer science degree, and I am the lead editor of the XQuery language for querying and transforming XML. Python is a great language for a lot of this, several of use Python as at least one of our languages. I tend to use XQuery quite a bit, a few weeks ago I taught for 3 day of Clifford Anderson's 2 week course in using XQuery in the digital humanities (xqueryinstitute.org), using Julius Caesar as the text. I think you will find that XQuery can do the queries you are interested in, so can emdros, which has a query language designed for corpus queries and can be called from Python.
More good news: a lot of good open data is now available, so you will have lots of data to work with. And syntax trees are available in more than one model. Here is some data you may be interested in looking at:
* The Abbott-Smith lexicon https://github.com/translatable-exegetical-tools/Abbott-Smith
* The Dodson lexicon (for glosses) https://github.com/biblicalhumanities/Dodson-Greek-Lexicon
* Alpheios ([url]alpheios.net[/url]) and Arethusa (see, e.g.http://alpheios.net/bookmarklet/odyssey.html
), which support syntax tree diagramming, integrate a Greek dictionary and grammar into the web browser, and are integrating language learning tools.
* Nestle 1904 with syntax trees and morphological tags (constituent model) https://github.com/biblicalhumanities/Nestle1904/ https://github.com/biblicalhumanities/g ... nestle1904
* SBLGNT syntax trees with morphology (constituent model) https://github.com/biblicalhumanities/greek-new-testament/tree/master/syntax-trees/sblgnt
* emdros - a corpus query tool http://emdros.org/
* Dag Haug's PROIEL syntax trees with morphology (dependency model) http://proiel.github.io/
* Bruce Robertson's OCR work. Check out commentaries, Migne, St. John of Chrysostom, Thackaray, etc. http://heml.mta.ca/lace/catalog
* Steve Levinsohn has made his discourse analysis available in PDFs: http://www-01.sil.org/~levinsohns/BART.html
* Alan Bunning has the Greek textual variants up to 400 AD here:
ἐξίσταντο δὲ πάντες καὶ διηποροῦντο, ἄλλος πρὸς ἄλλον λέγοντες, τί θέλει τοῦτο εἶναι;