Re: Review Request of Python Code

2016-03-10 Thread subhabangalore
On Friday, March 11, 2016 at 12:22:31 AM UTC+5:30, Matt Wheeler wrote: > On 10 March 2016 at 18:12, wrote: > > Matt, thank you for if...else suggestion, the data of NewTotalTag.txt > > is like a simple list of words with unconventional tags, like, > > > > w1 tag1 > > w2 tag2 > > w3 tag3 > > ... >

Re: Review Request of Python Code

2016-03-10 Thread Mark Lawrence
On 09/03/2016 04:18, subhabangal...@gmail.com wrote: Dear Group, I am trying to write a code for pulling data from MySQL at the backend and annotating words and trying to put the results as separated sentences with each line. The code is generally running fine but I am feeling it may be better

RE: Review Request of Python Code

2016-03-10 Thread Joaquin Alzola
lf Of subhabangal...@gmail.com Sent: 10 March 2016 18:12 To: python-list@python.org Subject: Re: Review Request of Python Code On Wednesday, March 9, 2016 at 9:49:17 AM UTC+5:30, subhaba...@gmail.com wrote: > Dear Group, > > I am trying to write a code for pulling data from MySQL at t

Re: Review Request of Python Code

2016-03-10 Thread Matt Wheeler
On 10 March 2016 at 18:12, wrote: > Matt, thank you for if...else suggestion, the data of NewTotalTag.txt > is like a simple list of words with unconventional tags, like, > > w1 tag1 > w2 tag2 > w3 tag3 > ... > ... > w3 tag3 > > like that. I suspected so. The way your code currently works, if y

Re: Review Request of Python Code

2016-03-10 Thread BartC
On 10/03/2016 18:12, subhabangal...@gmail.com wrote: On Wednesday, March 9, 2016 at 9:49:17 AM UTC+5:30, subhaba...@gmail.com wrote: Thank you Steve for writing the whole code. It is working full and fine. But speed is still an issue. We need to speed up. Which bit is too slow? (Perhaps the

Re: Review Request of Python Code

2016-03-10 Thread subhabangalore
On Wednesday, March 9, 2016 at 9:49:17 AM UTC+5:30, subhaba...@gmail.com wrote: > Dear Group, > > I am trying to write a code for pulling data from MySQL at the backend and > annotating words and trying to put the results as separated sentences with > each line. The code is generally running fin

Re: Review Request of Python Code

2016-03-09 Thread Matt Wheeler
On 9 March 2016 at 12:06, Matt Wheeler wrote: > But we can still do better. A list is a poor choice for this kind of > lookup, as Python has no way to find elements other than by checking > them one after another. (given (one of the) name(s) you've given it > sounds a bit like "dictionary" I assum

Re: Review Request of Python Code

2016-03-09 Thread Matt Wheeler
I'm just going to focus on a couple of lines as others are already looking at the whole thing: On 9 March 2016 at 04:18, wrote: > [snip]. > if word in a4: > [stuff] > elif word not in a4: > [other stuff] >

Re: Review Request of Python Code

2016-03-09 Thread Friedrich Rentsch
On 03/09/2016 05:18 AM, subhabangal...@gmail.com wrote: Dear Group, I am trying to write a code for pulling data from MySQL at the backend and annotating words and trying to put the results as separated sentences with each line. The code is generally running fine but I am feeling it may be b

Re: Review Request of Python Code

2016-03-08 Thread INADA Naoki
While MySQL doesn't have server side cursor, MySQLdb has SSCursor class. https://github.com/PyMySQL/mysqlclient-python/blob/master/MySQLdb/cursors.py#L551 Default cursor fetches MySQL response at once and convert them into Python object. SSCursor fetches MySQL response row by row. So it saves Pyt

Re: Review Request of Python Code

2016-03-08 Thread Steven D'Aprano
On Wednesday 09 March 2016 15:18, subhabangal...@gmail.com wrote: > I am trying to copy the code here, for your kind review. > > import MySQLdb > import nltk > def sql_connect_NewTest1(): This function says that it connects to the SQL database, but actually does much more. It does too much. Spl