works, need to implement traditional

master
Dario Ernst 14 years ago
parent f9685346ce
commit 02373b86d3

@ -34,10 +34,15 @@ while hzwork:
tmpstr += hzwork[0] tmpstr += hzwork[0]
print "checking for %s (%s)"%(tmpstr,tmpstr.__repr__()) print "checking for %s (%s)"%(tmpstr,tmpstr.__repr__())
res = slconn.execute('SELECT pinyin FROM entries WHERE simplified="%s"'%tmpstr).fetchall() res = slconn.execute('SELECT pinyin FROM entries WHERE simplified="%s"'%tmpstr).fetchall()
if res != []: if res != []: # sequence of chars not found, using last result
lastres = res[0][0] lastres = res[0][0]
hzwork.pop(0) hzwork.pop(0)
print "found and consumed %s"%res[0][0] print "found and consumed %s"%res[0][0]
elif res == [] and not lastres: # first char not found, using fallback barf
lastres = '[%s]'%tmpstr
hzwork.pop(0)
print "%s not found, adding raw and breaking"%tmpstr
break
else: else:
print "got empty result, breaking" print "got empty result, breaking"
break break

Loading…
Cancel
Save