Permalink
Browse files

Add reviewclozes.

  • Loading branch information...
1 parent 48d5179 commit 97bd9c5822a188585e31ba27765f2f6a83fac0ab 伴上段 committed Nov 22, 2012
Showing with 47 additions and 1 deletion.
  1. +1 −0 README.md
  2. +1 −1 install.sh
  3. +45 −0 reviewclozes
View
@@ -63,6 +63,7 @@ Most of the scripts use the Bourne shell (`sh`) and the standard `awk` (actually
* `genline` is a handy script that appends new cards generated from its parameters to the specified deck. It automatically generates the cards' unique IDs and adds blank rubi annotations for kanji (Chinese) characters via `rubify`.
* `reviewsome` is the driver behind `reviewsentences` and `reviewkanji`. It uses SM-2 to select flashcards from the specified deck and sets up a local HTTP server on port 1337 to review them. It requires a "filter program" to transform `oboeta`'s output into suitable lines for `oboetahttp`. Honden has two filters, `filterkanji` and `filtersentences`, for kanji decks and Japanese sentence decks, respectively. `reviewkanji` and `reviewsentences` set all of this up for you assuming that you have decks named "kanji" and "sentences".
* `seesome` is identical to `reviewsome` but does not log review results.
+* `reviewclozes` is like `reviewsentences` but it generates and reviews cloze deletions from the answer (back) fields of a sentence deck.
NOTE: Some of the Japanese-specific scripts depend on [Hinomoto](https://github.com/joodan-van-github/hinomoto), a small collection of programs for parsing and tagging Unicode text. Of course, you can remove these dependencies.
View
@@ -29,5 +29,5 @@ mkdir -p -m 0755 $1/other
echo "Installing scripts"
set -x
-install backupall backupcards carddate downloadsds edeck filterkanji filtersentences genkanjicards genline getsds logdate newdeck nextid reviewkanji reviewsentences reviewsome rubify seedeck seesome $1
+install backupall backupcards carddate downloadsds edeck filterkanji filtersentences genkanjicards genline getsds logdate newdeck nextid reviewclozes reviewkanji reviewsentences reviewsome rubify seedeck seesome $1
View
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# Review Sentences with Cloze Deletions over HTTP
+# Written in 2012 by 伴上段
+#
+# To the extent possible under law, the author(s) have dedicated all copyright
+# and related and neighboring rights to this software to the public domain
+# worldwide. This software is distributed without any warranty.
+#
+# You should have received a copy of the CC0 Public Domain Dedication along
+# with this software. If not, see
+# <http://creativecommons.org/publicdomain/zero/1.0/>.
+
+# This script assumes that the cloze annotations are in the answer fields
+# (backs) of the sentence flashcards.
+
+usage() {
+ echo "Usage: `basename $0` [-h] deck-name-no-extension"
+}
+
+if [ $# -le 2 -a "$1" = "-h" ]; then
+ usage
+ exit 0
+elif [ $# -ne 1 ]; then
+ usage >&2
+ exit 1
+fi
+
+cpipe=reviewsome.$$.command
+cleanup() {
+ rm -f $cpipe
+}
+trap cleanup EXIT INT
+mkfifo -m 0700 $cpipe
+
+touch decks/$1.clozes.log
+cut --complement -f 1 decks/$1.txt | ocloze | osm2 -n 30 -e 10 decks/$1.clozes.log | rubify | oboeta -2 $cpipe decks/$1.clozes.log | gawk '
+{
+ for (n = 1; n <= NF - 5; n++) {
+ printf("%s\t", $n)
+ }
+ printf("%s\n", $(NF - 4))
+ system("")
+}' | filtersentences | oboetahttp -2 -n '\"HanaMinA\", sans-serif' -i 48 >$cpipe
+

0 comments on commit 97bd9c5

Please sign in to comment.