Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83238

Re: need some guidance on Python syntax smart editor for use with speech recognition

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'subject:Python': 0.06; '2to3': 0.09; 'means,': 0.09; 'measure': 0.09; 'pep': 0.09; 'structure,': 0.09; 'subject:editor': 0.09; 'throws': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; '.py': 0.16; 'ast': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'helps.': 0.16; 'iteration,': 0.16; 'module?': 0.16; 'ought': 0.16; 'parser.': 0.16; 'subject: \n ': 0.16; 'tool.': 0.16; 'url:file': 0.16; 'url:post': 0.16; 'url:py': 0.16; 'visualizing': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'module': 0.19; 'trying': 0.19; 'file,': 0.19; 'subject:need': 0.19; 'written': 0.21; 'code,': 0.22; 'cc:addr:python.org': 0.22; 'this?': 0.23; 'parse': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'source': 0.25; 'suggested': 0.26; 'header:In-Reply-To:1': 0.27; '[1]': 0.29; 'topic': 0.29; '[2]': 0.30; 'matching': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'subject:some': 0.31; 'skip:c 30': 0.32; 'quite': 0.32; 'url:python': 0.33; 'could': 0.34; 'subject:with': 0.35; "can't": 0.35; 'something': 0.35; 'editor': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'doing': 0.36; 'useful': 0.36; 'url:org': 0.36; 'so,': 0.37; 'easily': 0.37; 'pm,': 0.38; 'anything': 0.39; 'hope': 0.61; 'first': 0.61; 'back': 0.62; "you'll": 0.62; 'kind': 0.63; 'great': 0.65; 'worth': 0.66; 'research,': 0.68; 'results': 0.69; '2015': 0.84; 'different.': 0.84; 'jonas': 0.84; 'url:cpython': 0.84; 'recover': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=5aR0QZ7+guFqnro9t8tuRFtucUvRfClVqv3i0Ouz2y8=; b=zV/ywgYIBDuQZf4VHn0dyIZWMBelSSxQk1t8qTku1cJuYzrMNTP3SyXD4nhDkhVHsN bMaTvO9faBdFDMzpnVi5f97qPfAW1nCzUn1RsvJhtza+CpXnHQE4+ylQXWR7D+MCEtWf Px1BXmfEMiT0pOv5Ft6dOnXyHcSNZX+ht/N+x/QRxeuNGz0/vKi56qU/n7PfX6SI/kSL 7xE7UZQ+eqD89w9HqhSmBSU8s9DKIWQeVrODqEoXKYcfUnP1GtkD+gwo0WCOHI3wBgBR 52rYnLKVOyN+rdf8YVJfyjGt7FoqF2uEtOuoy4cMrvmITivr3+XezbSS+i7BkB51Y8Eq yVRA==
MIME-Version 1.0
X-Received by 10.107.134.39 with SMTP id i39mr78840848iod.53.1420460669802; Mon, 05 Jan 2015 04:24:29 -0800 (PST)
In-Reply-To <54AA5ABC.4020103@wielicki.name>
References <54AA408F.4080101@harvee.org> <54AA5ABC.4020103@wielicki.name>
Date Mon, 5 Jan 2015 23:24:29 +1100
Subject Re: need some guidance on Python syntax smart editor for use with speech recognition
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17393.1420460678.18130.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1420460678 news.xs4all.nl 2938 [2001:888:2000:d::a6]:52646
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83238

Show key headers only | View raw


On Mon, Jan 5, 2015 at 8:34 PM, Jonas Wielicki <jonas@wielicki.name> wrote:
> As a first iteration, I would try with any editor written in Python.
> Are you familiar with the ast[1] module? It could be worth trying to
> use this module and perform some kind of pattern matching on the
> results to recover the information.

An AST parse throws away a lot of information. You can't easily
reconstruct the original code from that; at best, you can decompile
the AST back into functionally-equivalent source code, but it's not
something you want to do as part of editing code. There's an
Unparser() in CPython/Tools/parser/unparse.py [1] which is great for
visualizing an AST structure, but if you take a .py file, compile it
to AST, and then unparse it, you'll end up with something quite
different.

However, back when I was doing my PEP 463 research, someone suggested
looking into the 2to3 parser. I regretfully admit that I have yet to
actually do so, but it ought in theory allow source-level
transformations with a measure of intelligence. It's not a ready-made
solution by any means, but it could be a useful tool. [2]

> Hope this helps. I find that topic pretty interesting. Is there
> anything I can follow to see progress on this?

Likewise!

ChrisA

[1] https://hg.python.org/cpython/file/tip/Tools/parser/unparse.py
[2] http://time-loop.tumblr.com/post/47664644/python-ast-preserving-whitespace-and-comments

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: need some guidance on Python syntax smart editor for use with speech recognition Chris Angelico <rosuav@gmail.com> - 2015-01-05 23:24 +1100

csiph-web