Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/dict.py
diff options
context:
space:
mode:
Diffstat (limited to 'dict.py')
-rwxr-xr-x[-rw-r--r--]dict.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/dict.py b/dict.py
index aa953c9..d202439 100644..100755
--- a/dict.py
+++ b/dict.py
@@ -148,6 +148,31 @@ class Word:
self.cur.execute("INSERT into las_score (wordid, num_played) VALUES (?,?) ", (wordid,1, ))
self.conn.commit()
+
+
+
+ def get_phoneme(self):
+ self.cur.execute("SELECT * from las_phoneme where wordid = ?", (self.wordid,))
+ t = self.cur.fetchone()
+ if t != None:
+ (wordid, phoneme, num_syllabe, is_correct) = t
+ return (phoneme, is_correct)
+ else:return None
+
+ def update_phoneme(self, phoneme, is_correct = True):
+ #print phoneme
+ try:
+ if is_correct == True:
+ self.cur.execute("UPDATE las_phoneme SET phoneme = ?, is_correct = ? where wordid = ?", (phoneme, 1, self.wordid,))
+ else:
+ self.cur.execute("UPDATE las_phoneme SET phoneme = ?, is_correct = ? where wordid = ?", (phoneme, 0, self.wordid,))
+ except:
+ if is_correct == True:
+ self.cur.execute("INSERT into las_phoneme (wordid, phoneme, is_correct ) VALUES (?,?,?) ", (self.wordid, phoneme, 1, ))
+ else:
+ self.cur.execute("INSERT into las_phoneme (wordid, phoneme, is_correct ) VALUES (?,?,?) ", (self.wordid, phoneme, 0, ))
+ self.conn.commit()
+
if __name__ == "__main__":
k = Dict()
num_words = k.get_num_words()