diff -r 4a3188fc8951 -r 78bf1097106a py/gadict_srs_anki.py
--- a/py/gadict_srs_anki.py Thu Sep 15 19:19:34 2016 +0300
+++ b/py/gadict_srs_anki.py Thu Sep 15 19:58:01 2016 +0300
@@ -80,8 +80,11 @@
color: black;
background-color: white;
}
+.ask {
+ margin-bottom: 1.2em;
+}
span.headword {
- font-style: italic;
+ font-weight: bolt;
}
.pron {
color: magenta;
@@ -100,6 +103,9 @@
.syn {
color: blue;
}
+.attrs {
+ color: blue;
+}
"""
collection.models.addField(model, collection.models.newField('From'))
@@ -148,6 +154,8 @@
for (headwords, translations) in DOM[1:]:
identity = headwords[0].headword
buf = []
+ v1, v2, v3 = (None, None, None)
+ singular, plural = (None, None)
for hw in headwords:
buf.append("
")
buf.append("")
@@ -163,6 +171,16 @@
buf.append("")
buf.append(", ".join(l))
buf.append("")
+ if 'v1' in hw.attrs:
+ v1 = (hw.headword, hw.pron)
+ if 'v2' in hw.attrs:
+ v2 = (hw.headword, hw.pron)
+ if 'v3' in hw.attrs:
+ v3 = (hw.headword, hw.pron)
+ if 's' in hw.attrs:
+ singular = (hw.headword, hw.pron)
+ if 'pl' in hw.attrs:
+ plural = (hw.headword, hw.pron)
buf.append("
")
direct_from = "".join(buf)
buf = []
@@ -201,6 +219,23 @@
direct_to = "".join(buf)
builder.add_note("en->tr", identity, direct_from, direct_to)
builder.add_note("tr->en", identity, direct_to, direct_from)
+ if v1 and v2 and v3:
+ question = u"Find irregular verb:
"
+ riddle1 = u"{} [{}] v1".format(v1[0], v1[1])
+ riddle2 = u"{} [{}] v2".format(v2[0], v2[1])
+ riddle3 = u"{} [{}] v3".format(v3[0], v3[1])
+ answer = u"{}
{}
{}
{}".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)
+ if singular and plural:
+ question = u"Find plural:
"
+ riddle_s = u"{} [{}] s".format(singular[0], singular[1])
+ riddle_pl = u"{} [{}] pl".format(plural[0], plural[1])
+ answer = u"{}
{}
{}".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)
+
builder.export(FONAME)
finally: