--- a/py/gadict_srs_anki.py Wed Nov 09 22:24:47 2016 +0200
+++ b/py/gadict_srs_anki.py Wed Nov 09 23:16:21 2016 +0200
@@ -316,7 +316,7 @@
for (freqtag, freqset) in FREQ_SOURCES:
if identity in freqset:
freqtags.append(freqtag)
- freqmsg = None
+ freqmsg = ""
if len(freqtags) > 0:
freqmsg = ",".join(freqtags)
freqmsg = "<div class='freq'>{:s}</div>".format(freqmsg)
@@ -349,8 +349,6 @@
if 'pl' in hw.attrs:
plural = (hw.headword, hw.pron)
buf.append("</div>")
- if freqmsg:
- buf.append(freqmsg)
direct_from = "".join(buf)
buf = []
for sense in translations:
@@ -360,24 +358,24 @@
for sense in translations:
write_sense(buf, sense, with_examples = False)
reverse_from = "".join(buf) # without examples!!
- builder.add_note("en->tr", identity, direct_from, direct_to)
- builder.add_note("tr->en", identity, reverse_from, direct_from)
+ builder.add_note("en->tr", identity, direct_from + freqmsg, direct_to)
+ builder.add_note("tr->en", identity, reverse_from, direct_from + freqmsg)
if v1 and v2 and v3:
question = u"<div class='ask'>Find irregular verb:</div>"
riddle1 = u"<span class='headword'>{}</span> <span class='pron'>[{}]</span> <span class='attrs'>v1</span>".format(v1[0], v1[1])
riddle2 = u"<span class='headword'>{}</span> <span class='pron'>[{}]</span> <span class='attrs'>v2</span>".format(v2[0], v2[1])
riddle3 = u"<span class='headword'>{}</span> <span class='pron'>[{}]</span> <span class='attrs'>v3</span>".format(v3[0], v3[1])
- answer = u"{}<br>{}<br>{}<br>{}".format(riddle1, riddle2, riddle3, direct_to)
- builder.add_note("irregular1", identity, question + riddle1, answer)
- builder.add_note("irregular2", identity, question + riddle2, answer)
- builder.add_note("irregular3", identity, question + riddle3, answer)
+ answer = direct_from + direct_to
+ builder.add_note("irregular1", identity, question + riddle1 + freqmsg, answer)
+ builder.add_note("irregular2", identity, question + riddle2 + freqmsg, answer)
+ builder.add_note("irregular3", identity, question + riddle3 + freqmsg, answer)
if singular and plural:
question = u"<div class='ask'>Find plural:</div>"
riddle_s = u"<span class='headword'>{}</span> <span class='pron'>[{}]</span> <span class='attrs'>s</span>".format(singular[0], singular[1])
riddle_pl = u"<span class='headword'>{}</span> <span class='pron'>[{}]</span> <span class='attrs'>pl</span>".format(plural[0], plural[1])
- answer = u"{}<br>{}<br>{}".format(riddle_s, riddle_pl, direct_to)
- builder.add_note("singular", identity, question + riddle_s, answer)
- builder.add_note("plural", identity, question + riddle_pl, answer)
+ answer = direct_from + direct_to
+ builder.add_note("singular", identity, question + riddle_s + freqmsg, answer)
+ builder.add_note("plural", identity, question + riddle_pl + freqmsg, answer)
builder.export(FONAME)
finally: