(defun delnth (n l)
(if (zerop n)
(cdr l)
(let ((prev (nthcdr (1- n) l)))
(setcdr prev (cddr prev)))
l))
(defun random-insert (nb l)
(let ( (remaining (copy-sequence l) ) (inserted nil) (num -1) )
(while (> nb 0)
(while (and (> (length remaining) 0) (> nb 0))
(setq num (random (length remaining)))
(setq elem (nth num remaining))
(insert elem)
(setq inserted (cons elem inserted))
(setq remaining (delnth num remaining))
(setq nb (1- nb)))
(if (> nb 0)
(progn
(setq remaining inserted)
(setq inserted nil))))))
(defvar jp-hiragana '("か" "け" "き" "こ" "く" "じゃ"
"ぐ" "げ" "が" "ご" "ぎ" "と"
"て" "た" "お" "ひゃ" "あ" "え"
"い" "しゅ" "みゅ" "ぷ" "ぴゅ"
"ぱ" "ぺ" "ぴ" "う" "ぽ" "びゅ"
"じょ" "みょ" "ぴょ" "よ" "や"
"ゆ" "ひ" "ほ" "は" "へ" "きょ"
"ど" "で" "だ" "ちゃ" "しょ" "ぎゃ"
"つ" "りょ" "ぎょ" "め" "ま" "も"
"きゅ" "み" "む" "ちょ" "じゅ" "し"
"ひょ" "ぞ" "ぜ" "ざ" "ず" "づ"
"びょ" "ぎゅ" "ん" "る" "にゃ"
"れ" "ら" "ろ" "り" "ひゅ" "りゃ"
"に" "の" "な" "ね" "ぬ" "びゃ"
"りゅ" "じ" "ぢ" "ち" "わ" "を"
"ふ" "にゅ" "す" "そ" "さ" "べ"
"せ" "ば" "ぼ" "び" "ぶ" "みゃ"
"ぴゃ" "しゃ" "ちゅ" "にょ" "きゃ")
"List of all Japanese Hiragana with different sonorizations and
concatenated syllables")
(defun jp-insert-exo (nbchar)
"Print a page of Japanese exercice."
(interactive "nNumber of characters to print: ")
(random-insert nbchar jp-hiragana))
The function jp-insert-exo command insert the given number nbchar of hiragana into the current buffer.
One limitation is that hiragana are inserted on a line. One could enhance these functions to correctly write them from top to bottom and left to right.
We can imagine the same kind of thing for katakana or even kanji. This exercise is interesting when you start to learn kana. The goal is to overlearn the kana in order to be really at ease with them.
Print a page or two of them and now, let's practise Hiragana ! Just pronounce each hiragana loudly (or loudly in your head) one after the other.
Aucun commentaire:
Publier un commentaire