I have gone through from various stackoverflow posts and from other website as well but i am totally failed. I believe there is problem in writing but after viewing from other websites cannot figured it out. What i am doing is i ve one column which has all values and 2nd column is empty and i am now trying to inserting by using "Update". For better understanding please see picture bellow:
and code which i am trying is:
//skipped portion of code//
data=self.geturlname(id)
file_contents=self.gettextonly(data) #get text only
with open('foo.txt', 'r') as file:
file_contents = file.read()
Totalwords = float(len(file_contents.split()))
sentences = float(file_contents.count('.'))
paragraph = float(file_contents.count('\n'))
#fo = file_contents
fo = open("foo.txt", "r")
count = 0
for i in fo:
word = i
vowels = 'aeiouy'
word = word.lower().strip(".:;?!)(")
if word[0] in vowels:
count +=1
for index in range(1,len(word)):
if word[index] in vowels and word[index-1] not in vowels:
count +=1
if (word.endswith('e')) :
count -= 1
if word.endswith('le') :
count+=1
if count == 0:
count +=1
syl = count-(0.1*count)
ASL = float((1.015)*(Totalwords/sentences))
ASW = 84.6 *(syl/Totalwords)
s = ASL+ASW
Read_ease = 206.835-s
print 'Reading Ease',Read_ease
#return
#self.con.execute('select rowid from urllist')
self.con.execute("""UPDATE urllist SET textcomplexity = ? WHERE url = ?"""(Read_ease, data))
#t =self.con.execute(UPDATE Table SET column = ? WHERE column2 = ?
#txtcmplx = self.con.execute("insert into urllist (url,textcomplexity) values(data,Read_ease)")
return #txtcmplx.lastrowid
And Error:
"C:\Users\DELL\Desktop\python\s\fyp\Relevancy\M\pyThinSearch\pythinsearch14.py", line 1060, in textcomplexity
self.con.execute("""UPDATE urllist SET textcomplexity = ? WHERE url = ?""", (Read_ease, data))
OperationalError: no such column: textcomplexity
Aucun commentaire:
Enregistrer un commentaire