Option to include Irregular verb and plural form.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sat, 12 Nov 2016 12:12:04 +0200
changeset 673 ca1d4a6e201b
parent 671 dc5379ac792d
child 674 fe57401d8109
Option to include Irregular verb and plural form.
Makefile
py/gadict_srs_anki.py
--- a/Makefile	Sat Nov 12 00:48:32 2016 +0200
+++ b/Makefile	Sat Nov 12 12:12:04 2016 +0200
@@ -529,13 +529,13 @@
 anki: $(SRS_ANKI_FILES)
 
 dist/anki/%.apkg: %.gadict %.del py/gadict.py py/gadict_srs_anki.py $(FREQLIST_DEP) $(MAKEFILE_LIST) | dist/anki/
-	PYTHONPATH=/usr/share/anki: python -B py/gadict_srs_anki.py $(FREQLIST_OPT) $< $@
+	PYTHONPATH=/usr/share/anki: python -B py/gadict_srs_anki.py -rich $(FREQLIST_OPT) $< $@
 
 dist/anki/gadict_voa.apkg: gadict_voa.gadict py/gadict.py py/gadict_srs_anki.py $(VOA_FREQLIST_DEP) $(MAKEFILE_LIST) | dist/anki/
 	PYTHONPATH=/usr/share/anki: python -B py/gadict_srs_anki.py $(VOA_FREQLIST_OPT) $< $@
 
 dist/anki/%.apkg: %.gadict py/gadict.py py/gadict_srs_anki.py $(FREQLIST_DEP) $(MAKEFILE_LIST) | dist/anki/
-	PYTHONPATH=/usr/share/anki: python -B py/gadict_srs_anki.py $(FREQLIST_OPT) $< $@
+	PYTHONPATH=/usr/share/anki: python -B py/gadict_srs_anki.py -rich $(FREQLIST_OPT) $< $@
 
 dist/srs/gadict_en-ru+uk.tab.txt: gadict_en-ru+uk.gadict py/gadict.py py/gadict_srs_tab.py $(MAKEFILE_LIST) | dist/srs/
 	python3 -B py/gadict_srs_tab.py  $< $@ -lang:ru,uk
--- a/py/gadict_srs_anki.py	Sat Nov 12 00:48:32 2016 +0200
+++ b/py/gadict_srs_anki.py	Sat Nov 12 12:12:04 2016 +0200
@@ -18,6 +18,7 @@
 FONAME = None
 LANGS = None
 FREQ_SOURCES = []
+RICH_MODE = False
 
 # -lang:ru,uk
 ARG_LANG_RE = regex.compile("-lang:(.+)")
@@ -53,6 +54,9 @@
                 wlist = parser.parse()
             FREQ_SOURCES.append((tag, set(wlist)))
             continue
+        if arg == "-rich":
+            RICH_MODE = True
+            continue
         if arg.startswith("-"):
             raise Exception("Unsupported option format: '{:s}'".format(arg))
     if not FINAME:
@@ -360,7 +364,7 @@
         reverse_from = "".join(buf)         # without examples!!
         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:
+        if v1 and v2 and v3 and RICH_MODE:
             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])
@@ -369,7 +373,7 @@
             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:
+        if singular and plural and RICH_MODE:
             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])