Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:Python': 0.05; 'great.': 0.07; 'parsing': 0.07; 'remaining': 0.07; 'subject:question': 0.08; 'python': 0.09; 'parsed': 0.09; 'path)': 0.09; 'subject:parsing': 0.09; ':-)': 0.13; 'keywords.': 0.16; 'remain,': 0.16; 'tokenize': 0.16; 'translation': 0.16; 'wrote:': 0.17; 'exists': 0.17; 'thanks,': 0.18; 'code,': 0.18; 'code.': 0.20; 'finally,': 0.22; 'example': 0.23; 'statement': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:[ 10': 0.26; 'am,': 0.27; 'this?': 0.28; '(maybe': 0.29; 'statements': 0.29; '(from': 0.30; 'stuff': 0.30; 'problem': 0.33; 'to:addr:python-list': 0.33; 'minimum': 0.34; 'path': 0.35; 'something': 0.35; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'url:org': 0.36; 'method': 0.36; "i'll": 0.36; 'subject:: ': 0.38; 'object': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'easily': 0.39; 'space': 0.39; 'little': 0.39; 'received:192.168': 0.40; 'header:Received:5': 0.40; 'first': 0.61; 'more': 0.63; 'here': 0.65; 'family': 0.68; 'friends': 0.83; 'divide': 0.84; 'nagy': 0.84; 'received:192.168.1.7': 0.84; 'recognition': 0.84; 'speech': 0.84; 'url:api': 0.84; 'look.': 0.91; 'technique': 0.93 X-Virus-Scanned: amavisd-new at harvee.org Date: Mon, 30 Jul 2012 05:57:40 -0400 From: "Eric S. Johansson" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: simplified Python parsing question References: <5015C58D.4040101@harvee.org> <50165308.5060708@shopzeus.com> In-Reply-To: <50165308.5060708@shopzeus.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343642267 news.xs4all.nl 6906 [2001:888:2000:d::a6]:38257 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26241 On 7/30/2012 5:25 AM, Laszlo Nagy wrote: > > Did you try to use pygments? > > http://pygments.org/docs/api/ > thanks, I'll take a look. > > I would first tokenize the code, then divide it by statement keywords. > Finally, you just need to find expression/assignment statements in the > remaining sections. (Maybe there is a better way to do it.) > > > yeah the problem is also little more complicated than simple parsing of Python code. For example, one example (from the white paper) *meat space blowback = Friends and family [well-meaning attempt] *could that be parsed by the tools you mention? I suspect not but this is what I need to generate using speech recognition because it's easily spoken. A more complex example might be something like new base = OS path-base name (old path) or if OS base exists (current path): new base name = OS path base name(current path) What's particularly cute here is that using the translation technique I can actually describe the full object method path with a minimum of speaking overhead. Python is great. :-) But the questions remain, will these tools are stuff like this?