need some guidance on Python syntax smart editor for use with speech recognition
jonas at wielicki.name
Mon Jan 5 10:34:52 CET 2015
-----BEGIN PGP SIGNED MESSAGE-----
On 05.01.2015 08:43, Eric S. Johansson wrote:
> what's a good open editor ( preferably multiplatform) that
> actually decomposes Python code into fundamental components such as
> class, expression, etc. and, lets you operate on those components?
> this is in contrast to editors such as Emacs which give you some
> fundamental pieces you can operate on but it's really character
> oriented and all of the syntax smartness not really available for
> coupling to speech recognition environment. it would be great if it
> was in Python so I don't have to learn yet another fricking
As a first iteration, I would try with any editor written in Python.
Are you familiar with the ast module? It could be worth trying to
use this module and perform some kind of pattern matching on the
results to recover the information.
In case you don’t know, the module produces a tree of objects
representing the syntactic representation of the Python code. The
example you gave should be easily recoverable from the AST
representation, assuming togglename has run through (appearantly, the
code is not valid python without the togglename transformation).
I would start small in that case. At some point, one would probably
need a XML Stylesheet-ish transformation language (not neccessarily in
XML; the main point is that you may need complex matching rules). For
the beginning, hardcoded rules might suffice, and for the cases where
it doesn’t work, you could persue Chris’ approach of falling back to
Basically, you could formalize your template language to operate on
ASTs and write a pattern matcher recognizing ASTs which have been
generated from a given template.
Hope this helps. I find that topic pretty interesting. Is there
anything I can follow to see progress on this?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
-----END PGP SIGNATURE-----
More information about the Python-list