def stem(word):
global c_bot
stemArray=[]
stemArrayRan=[]
conn = sqlite3.connect('userData.db')
c=conn.execute('SELECT sensation from symptoms')
sympsToStem=c.fetchall()
sympToStem=''
for sympToStem in sympsToStem:
stemArray.append(sympToStem)
#print("hello",list(sympToStem))
print("*********")
#print("stemmed finale",stemmer.stem(word.lower()))
for h in range(len(stemArray)):
counter=0
print(list(stemArray[h]))
word=list(stemArray[h])
print("newfound",word)
print("stemm it",stemmer.stem(word.lower()))
word=''
sentence=''
#sentence=c_bot.get()
#main()
tryy=stem(word)
I'm not sure why the function doensn't let me pass the variable 'word' as a list, but does anyone know how I can get it to stem individual words from a user input into a sqlite3 database?
This is the error:
line 76, in stem print("stemm it",stemmer.stem(word.lower())) AttributeError: 'list' object has no attribute 'lower'
#######
def submitChatbot():
global c_bot
# Create a database or connect to one
conn = sqlite3.connect('userData.db')
# Create cursor
c = conn.cursor()
# Insert Into Table
c.execute("INSERT INTO symptoms VALUES (null,:c_bot)",
{
'c_bot': c_bot.get().lower()
})
#Commit Changes
conn.commit()
# Close Connection
conn.close()
# Clear The Text Boxes
c_bot.delete(0, END)
def stem(word):
global c_bot
stemArray=[]
stemArrayRan=[]
conn = sqlite3.connect('userData.db')
c=conn.execute('SELECT sensation from symptoms')
sympsToStem=c.fetchall()
sympToStem=''
for sympToStem in sympsToStem:
stemArray.append(sympToStem)
#print("hello",list(sympToStem))
print("*********")
#print("stemmed finale",stemmer.stem(word.lower()))
for h in range(len(stemArray)):
counter=0
print(stemArray[h])
word=stemArray[h]
print("newfound",word)
print("stemm it",stemmer.stem(word))