Bỏ qua đến nội dung

Cloze Generator

Chờ xử lý #anki #addon #cloze #generator
Unknown
22/7/2018

Cách tải addon Cloze Generator

Bạn có thể tải addon bằng một trong hai cách sau:

Click nút Copy bên dưới để copy code vào clipboard

198750399

Sau đó mở Anki → Tools → Add-ons → Get Add-ons → Dán code → OK

Mở trang addon trên AnkiWeb và tìm mã code ở cuối trang

Mở trên AnkiWeb

Cuộn xuống cuối trang AnkiWeb, tìm dòng có mã code 198750399 và copy

6
3

Mô tả chi tiết

Some of the excellent features of Anki include the ability to define multiple cards for a single note and support for cloze tests.

Unfortunately cloze tests cannot be added to a non-cloze note type.

An example of where such a facility would be useful is someone learning English who wishes to master irregular past tenses (such as ‘spring’, ‘sprang’, ‘sprung’). They may well have created a custom Verb note type with the English and non-English infinitives, as well as fields for the irregular English tenses and then want to use cloze tests to learn the irregular tenses.

I’m trying to learn Russian, and wrote this addin for myself to learn verb aspects pairs, and posted it here as I thought it may help others.

On startup the addon adds a Generate cloze submenu to the Tools menu. Every cloze mapping in the addon configuration is listed in the submenu, and selecting it will generated the cloze notes defined by the mapping.

To illustrate how to configure the mappings I’ll provide the example from my own setup of generating cloze cards for aspect pairs.

I have 2 cards types for learning verb aspect pairs:

  • a card type for learning verbs (“Russian vocabulary - verb”)
  • a cloze card type (“Russian cloze”) with cloze deletions for aspect pairs

The “Russian vocabulary - verb” card type has the following relevant fields:

  • Russian
  • Aspect
  • Pair
  • English

The “Pair” field holds the verb that is [one of] the verb’s aspect pair, and the “Aspect” field denotes what aspect this verb has (“imp” for imperfective verbs, “perf” for perfective verbs).

The “Russian cloze” card type has 2 fields:

  • Text
  • Note

The “Text” field is used for the cloze deletions, and for aspect pair cloze deletions the Note field is populated with the English meaning.

The Cloze Generator config to do this is:

“Verb Aspects”: { “Destination”: { “Deck”: “Grammar::verbs”, “Fields”: { “Note”: “to {{English}}”, “Text”: “{{c1::{{Pair}}::imp.}} - {{c2::{{Russian}}::perf.}}” }, “Note”: “Russian cloze” }, “Source”: “Russian vocabulary - verb”, “Where”: “perf in {{Aspect}}” }

This says to search all verb notes that have an Aspect field value of “perf”, and use the Pair and Russian fields to make a card with 2 cloze deletions on it.

The “Destination” section describes the cloze note that you are creating - what note type it is, what field values it has, and which deck it is placed in. When specifying what field values it has the fields copied from the source note type are enclosed in the usual Anki {{fieldname}} syntax, and use the field names from the source note type.

The “Source” element specifies what note type provides the source data, and the optional “Where” element allows you to select only a subset of those notes.

The generated card can have a tag set by adding a “Tags” : “tagname” element to the “Destination” section.

So, in my setup, for the “Russian vocabulary - verb” card with the following values:

  • Russian = взять
  • Aspect = perf
  • Pair = брать
  • English = take

The following “Russian cloze” card is generated in the “Grammar::verbs” deck:

  • Text = {{c1::брать::imp.}} - {{c2::взять::perf.}}
  • Note = to take

As duplicate cards are ignored all I have to do to add a cloze card for the aspect pair after adding a verb card is to select the “Tools > Generate cloze > Verb Aspects” menu item.

Some points to note:

Anki needs to be restarted in order to display a new mapping in the Generate cloze submenu

the addon will not generate duplicate notes, so it can be run multiple times against the same source data

the addon will not generate notes with an empty cloze element - allowing the addon to be run against notes where cloze notes should only be generated for some notes

the addon does not manage cloze notes once generated (eg. deleting them if no longer required as the source data has been deleted)

tags can be defined in the mapping to apply to the generated cloze notes


Reviews (8)

👍 2024-04-14

Dfgghhhhjg

👍 2019-10-15

Amazingly awesome add-on! Comment from author Thank you - I appreciate your thanks

👍 2019-10-15

GREAT WORK! Comment from author Thank you - I appreciate your thanks

👍 2019-10-14

I like the idea.

However, I would like do have a better explanation with screenshots. You had a good example in the description with the “Irregular Verbs”.

The example code you show is a bit too theoretical. It would help me much more to understand putting the “irregular verb” example into code, and then showing screenshots of actual anki screens. Comment from author Thank you for your thoughts.

I’d like to include screen shots as I agree that would explain things better, but I curren

👍 2019-10-02

need screenshot . how does it works ? Comment from author I’ve updated the description, so hopefully you will now have more idea of how to configure it

👍 2019-08-26

I like it for the idea. However, I’m afraid I need a more detailed explanation (screenshots and comparisons would be great) to apply it. Comment from author Thanks for your support - I hope that the updated description provides what you need.

👍 2018-10-03

quite useful, but a little bit difficult to config it

👍 2018-09-13

无法使用~

Anki 2.1.4 Python 3.6.1 Qt 5.9.2 PyQt 5.9

Platform: Windows 10

Flags: frz=True ao=True sv=1

Caught exception:

File “C:\Users\Administrator\AppData\Roaming\Anki2\addons21\198750399_init_.py”, line 28, in <lambda>

return lambda: onGenerate(key)

File “C:\Users\Administrator\AppData\Roaming\Anki2\addons21\198750399_init_.py”, line 20, in onGenerate

ti = ClozeImporter(source, cloze, deck, transformation, tags, mw.col)

File “C:\Users\Administrator\AppData\Roaming