Add files via upload

This commit is contained in:
Feripe-a 2021-07-10 14:30:25 -03:00 committed by GitHub
parent c7a7f591f6
commit 629cb6c0de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 122 additions and 0 deletions

View file

@ -0,0 +1,90 @@
# Japanese fallback
This card template was brought to you by フェリペ. It is based on [Japanese sentences](https://github.com/Ajatt-Tools/AnkiNoteTypes/tree/main/templates/Japanese%20sentences#japanese-sentences) and on card [template provided by a DJT user](https://tatsumoto-ren.github.io/blog/discussing-various-card-templates.html#fallback-cards).
![gif](gif1-example.gif)
Fallback cards (FBCs) are similar to SWCs and TSCs at first: youve got the target word on the front of the card and whatever you need to understand it on the back, an example sentence and pitch accent information -- if you make cards using [Mpvacious](https://github.com/Ajatt-Tools/mpvacious), youve also got the audio of the example sentence and an image. (That looks like SWCs, right?) When you hover over the target word a sentence appears, giving you the context in which you found the target word.
FBCs allow you do the following:
* Have a backup when you go like, “what the hell am I looking at?!” (hence its [name](https://www.oxfordlearnersdictionaries.com/definition/english/fallback?q=fallback))
* Forget about context-dependent memories but still benefit from TSCs, since youre testing yourself on the target word and still have the benefits that [TSCs can provide](https://tatsumoto-ren.github.io/blog/discussing-various-card-templates.html#targeted-sentence-cards-or-mpvacious-cards) on the back;
* Be flexible. A word becomes easier as you get familiar with it -- by seeing it on your immersion or on Anki. At first you can use the hover feature to review the card as a TSC, and later as a SWC when youre already familiar with the word and dont need a backup plan anymore.
## Converting TSCs into FBCs (and vice versa)
Its easy to convert your Mpvacious, TSC, cards into FBCs. Select the cards you want to convert, > Change note type > select “Fallback card” and make sure that each field is matching with each other.
![gif](gif2-notecon.gif)
## Footer
![image](image1.png)
Ive changed the original footers of Japanese sentences to match my needs. “Ichi.moe” is better than Jisho to parse sentences, in my opinion. “Images” puts the target word on Google JP, rather than the whole sentence. “Sentences” searchs the target word on Sentence Search, giving you more example sentences (tip: you can you can mine cards from that site).
Heres the original footer of Japanese sentences:
```
<footer>{{#SentKanji}}<a
href="https://jisho.org/search?keyword={{kanji:text:SentKanji}}" title="Sentence on Jisho">Jisho</a><a
href="https://www.google.co.jp/search?q={{kanji:text:SentKanji}}&tbm=isch" title="Search images">Images</a
>{{/SentKanji}}{{#VocabKanji}}<a
href="http://www.weblio.jp/content/{{text:VocabKanji}}" title="Vocab on Weblio">Weblio</a><a
href="https://wadoku.de/search/?q={{text:VocabKanji}}" title="Vocab on Wadoku">Wadoku</a>{{/VocabKanji}}</footer
>
```
![image](image2.png)
## Included card types
### 1: Recognition
This card type tests your reading comprehension.
On the front side, there is a target word, when you hover over it, an example sentence appears.
On the back there's the sentence you found your target word. On the back you can put the definitions and pronunciations of the target word, as well as pictures and sentence audio -- I use Mpvacious and Yomichan to create cards from anime, so all that work is done for me.
The note type also contains a separate field for Japanese pitch accent pattern.
I use [this Anki add-on](https://ankiweb.net/shared/info/1225470483) to generate pitch accents.
### 2: Production
This card type is designed to teach you how to write the target word.
To make a production card select the desired note in the Anki Browser
and fill the MakeProductionCard field with any text you like.
The target word on the new card is replaced with its kana reading,
and your goal is to write it in kanji.
The back of the card includes a stroke order diagram for the target word.
For further explanation, see [Writing Japanese guide](https://tatsumoto-ren.github.io/blog/writing-japanese.html).
## Yomichan settings
![screenshot](yomichan_anki_settings.webp)
Adding `{cloze-prefix}<b>{cloze-body}</b>{cloze-suffix}` to the settings
lets you automatically highlight the target word.
## Japanese Support settings
To configure the [Japanese support](https://ankiweb.net/shared/info/3918629684) add-on,
open Anki and go to Tools > Add-ons > Japanese Support > Config.
My config looks like this:
```
{
"dstFields": [
"SentFurigana",
"VocabFurigana"
],
"furiganaSuffix": " (furigana)",
"noteTypes": [
"japanese",
"subs2srs"
],
"skipNumbers": false,
"srcFields": [
"SentKanji",
"VocabKanji"
]
}
```
Make sure to apply these settings to be able to generate furigana when using this Note Type.
Its good to try new things out, so give it a try. You might like it.

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View file

@ -0,0 +1,32 @@
{
"modelName": "Japanese fallback",
"inOrderFields": [
"SentKanji",
"SentFurigana",
"SentEng",
"SentAudio",
"MorphManFocus",
"VocabKanji",
"VocabFurigana",
"VocabPitchPattern",
"VocabPitchNum",
"VocabDef",
"VocabAudio",
"Image",
"Notes",
"MakeProductionCard"
],
"css": "@charset \"utf-8\";\n@font-face {\n\tfont-family: \"KanjiStrokeOrders\";\n\tsrc:\n\t\tlocal(\"KanjiStrokeOrders\"),\n\t\turl(\"_kso.ttf\");\n}\n@font-face {\n\tfont-family: \"Yu Mincho\";\n\tsrc:\n\t\tlocal(\"Yu Mincho\"),\n\t\tlocal(\"\u6e38\u660e\u671d\"),\n\t\turl(\"_yumin.ttf\");\n}\n@font-face {\n\tfont-family: \"Yu Mincho\";\n\tsrc:\n\t\tlocal(\"Yu Mincho Demibold\"),\n\t\tlocal(\"\u6e38\u660e\u671d Demibold\"),\n\t\turl(\"_yumindb.ttf\");\n\tfont-weight: 600;\n}\n\n* { box-sizing: border-box; padding: 0; margin: 0; }\n.card {\n\tbackground-color: #FFFAF0;\n\tcolor: #2A1B0A;\n\tfont-family:\t\"Noto Serif\",\n\t\t\t\t\t\t\t\t\t\"Noto Serif CJK JP\",\n\t\t\t\t\t\t\t\t\tYu Mincho,\n\t\t\t\t\t\t\t\t\t\"Liberation Serif\",\n\t\t\t\t\t\t\t\t\t\"Times New Roman\",\n\t\t\t\t\t\t\t\t\tTimes,\n\t\t\t\t\t\t\t\t\tGeorgia,\n\t\t\t\t\t\t\t\t\tSerif;\n\tfont-size: 24px;\n\ttext-align: left;\n\tline-height: 1.4;\n\tmax-width: 800px;\n\tmargin: 0 auto;\n}\n.card1 { }\n.card2 .jpsentence ruby rt { opacity: 0; }\n.card2 .jpsentence:hover ruby rt { opacity: 1; }\n\nhr { margin: 2px 0; clear: both; }\nb { font-weight: 600; }\n.jpsentence b { color: grey; }\n\n/* links */\na { color: gray; }\na:hover { color: #722a2a ; }\na.hint { text-decoration: none; text-align: left; display: block; }\n\n/* Hide furigana on front */\nnokana ruby rt { opacity:0.0; font-size:0; display: none; }\nnotext b { background-color: black; color:transparent; }\n\n/* Top */\nheader { font-size: 14px; line-height: 18px; clear: both; }\nheader > div:not(:last-child) { margin-right: 3px; }\n\n/* Space between elements */\n.images { margin-top: 16px; }\n.images > img { margin-bottom: 16px; }\n\n/* Japanese sentence */\n.jpsentence { font-size: 35px; }\n\n.tags {\n\tfont-family: \"Noto Sans\", \"Noto Sans CJK JP\", \"Liberation Sans\", Arial, Sans, sans-serif;\n\ttext-align: center;\n\tdisplay: inline-block;\n\ttext-transform: lowercase;\n\tbackground-color: #333;\n\tcolor: #FFFAF0;\n\tfont-weight: bold;\n\tpadding: 1px 3px;\n\tmargin: 0;\n\tcursor: pointer;\n\tborder-radius: 3px;\n\tfont-size: 12px;\n\tline-height: 14px;\n}\n\n/* AnkiDroid peplay button */\n.replaybutton { margin: 0; margin-right: 3px; text-decoration: none; }\n.replaybutton span { padding: 0; font-size: 16px; }\n.replaybutton span svg {\n\tfill: #FFFAF0;\n\tbackground: #333;\n\tborder-radius: 3px;\n\tvertical-align: top; \n\tmin-width: 16px;\n\tmin-height: 16px;\n}\n\n/* PC peplay button */\na.replay-button { top: -.125em; position: relative; }\na.replay-button svg {\n\theight: 1em;\n\twidth: 1em;\n}\na.replay-button svg path { fill: #FFFAF0; }\na.replay-button svg circle { fill: #333; }\n\n/* Footer and links */\nfooter {font-size: 16px; text-align: center; }\nfooter>a { text-decoration: none; }\nfooter > a:after {content:\"\u00b7\"; color: brown; display: inline-block; width: 6px; }\nfooter > a:last-child:after {content:\"\"; width: 0; }\n\n/* Vocab */\n.vocab { margin-top: 16px; }\n.vocab div { display: inline-block; }\n.vocab br { display: none; }\n.vocab > .tags { vertical-align: top; }\n.notes > .tags { vertical-align: bottom; }\n\n/* Images */\n.images {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tflex-direction: row;\n\talign-items: flex-start;\n\talign-content: space-between;\n\tjustify-content: space-evenly;\n}\n.images > img {\n\tmax-width: 47%;\n\tborder-radius: 4px;\n\tfilter: sepia(33%);\n}\n.images>img:only-child {\n max-width: 100%;\n}\n\n/* Production cards */\n.production b { visibility: hidden; }\n.strokeorder {\n\ttext-align: center;\n\tfont-size: 150px;\n\tfont-family: KanjiStrokeOrders;\n}\n\n/* Morphman coloring */\n.fside .jpsentence:hover [mtype=unknown] { background-color: #ffff99; }\n.fside .jpsentence:hover [mtype=seen] { background-color: #ffd1b3; }\n.fside .jpsentence:hover [mtype=known] { background-color: #b3e6cc; }\n.fside .jpsentence:hover [mtype=mature] { background-color: transparent; }\n.fside .jpsentence:hover [priority=true] { }\n.fside .jpsentence:hover [frequency=true] { }\n\ndel.MorphManHide, del.morphmanhide {display:none;}\n\n/* Fix for Yomichan defs */\nul, ol {\n list-style-type: none; \n display: inline;\n margin: 0px;\n padding: 0px;\n}\n/* Fix for Yomichan pitch accents */\n.vocab ol > li { display: inline; }\n.vocab ol > li:after { content: \"\u30fb\"; }\n.vocab ol > li:last-child:after { content: \"\"; }\n\n/* Fallback config */\n\n/*\n#flip[data-line]::after {\n position:absolute;\n font-size: 50%; \n content: \"\u21f5\";\n}\n*/\n\n#flip[data-line=\"\"]::after {\n content: \"\";\n}\n \n#flip[data-line]:hover span, .hover[data-line] span {\n display:none;\n}\n \n#flip[data-line=\"\"]:hover span, .hover[data-line=\"\"] span {\n display:block;\n}\n \n#flip:hover::before, .hover::before {\n content: attr(data-line);\n}\n\n/* Fallback sentence */\n.fallback { font-size: 45px; }\n.fallback { text-align: center; }\n.fallback:hover { text-align: left; }\n\n/* Fallback config */",
"cardTemplates": [
{
"Name": "Recognition",
"Front": "\n<header>\n\t{{#MorphManFocus}}\n\t\t<div class=\"tags\">{{MorphManFocus}}</div>\n\t{{/MorphManFocus}}\n\t{{#Tags}}\n\t\t<div class=\"tags\">{{Tags}}</div>\n\t{{/Tags}}\n</header>\n\n<div class=\"fallback\" lang=\"ja\" id='flip' data-line='{{SentKanji}}'><span>{{furigana:VocabKanji}}</span></div>\n \n<script>\n //handle html that anki may put into the sentence field\n var s = document.getElementById(\"flip\").dataset.line;\n if (s.length > 0) {\n s = s.replace(/<br>|<div>/ig, '\\r\\n');\n s = s.replace(/<[^<]*>/ig, '');\n document.getElementById(\"flip\").dataset.line = s;\n \n //https://ankiweb.net/shared/info/1642550423\n document.addEventListener(\"keyup\", e=>{\n if(e.shiftKey) {\n if(document.getElementById(\"flip\").classList.contains(\"hover\"))\n document.getElementById(\"flip\").classList.remove(\"hover\");\n else\n document.getElementById(\"flip\").classList.add(\"hover\");\n }\n });\n }\n</script>\n\n<!--\n<div class=\"jpsentence\" lang=\"ja\">\n\t{{morphHighlight:furigana:SentKanji}}\n\t{{^SentKanji}}\n\t\t<nokana>{{kanji:SentFurigana}}</nokana>\n\t{{/SentKanji}}\n</div>\n-->\n\n<div style=\"display:none;\">\n\t<div id=\"pitchnum_hidden\">{{VocabPitchNum}}</div>\n\t<div id=\"kanaword_hidden\">{{kana:VocabFurigana}}</div>\n</div>\n\n<script>\n\t/* Paints the question word according to its Pitch Accent number.\n\t * blue for \u5e73\u677f\n\t * red for \u982d\u9ad8\n\t * orange for \u4e2d\u9ad8\n\t * green for \u5c3e\u9ad8\n\t */\n\tfunction markPitch() {\n\t\tvar pitchNumber = document.getElementById(\"pitchnum_hidden\");\n\t\tif (pitchNumber === null) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tpitchNumber = pitchNumber.innerHTML.match(/\\d/);\n\t\t}\n\t\tif (pitchNumber === null) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tpitchNumber = Number(pitchNumber);\n\t\t}\n\n\t\t/* Then decide what color to use and change font color accordingly. */\n\t\tif ( pitchNumber == 0 ) {\n\t\t\t// use blue for \u5e73\u677f\n\t\t\tpaintTargetWord(\"#3366CC\");\n\t\t} else if ( pitchNumber == 1 ) {\n\t\t\t// use red for \u982d\u9ad8\n\t\t\tpaintTargetWord(\"red\");\n\t\t} else if ( pitchNumber > 1 ) {\n\t\t\tif ( odaka(pitchNumber) ) {\n\t\t\t\t// use green for \u5c3e\u9ad8\n\t\t\t\tpaintTargetWord(\"green\");\n\t\t\t} else {\n\t\t\t\t// use orange for \u4e2d\u9ad8\n\t\t\t\tpaintTargetWord(\"#ff6207\");\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfunction paintTargetWord(color) {\n\t\tfor (sentence of document.getElementsByClassName(\"jpsentence\")) {\n\t\t\tfor (word of sentence.getElementsByTagName(\"b\")) {\n\t\t\t\tword.style.color = color;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction odaka(pitch_num) {\n\t\t// word is odaka if number of moras is equal to pitch accent position\n\t\tconst vocab_kana = document.getElementById(\"kanaword_hidden\");\n\t\tif (vocab_kana === null) {\n\t\t\treturn false;\n\t\t}\n\t\t// small \u3063 is one mora; \u3083\u3085\u3087 are parts of single mora\n\t\tconst n_moras = vocab_kana.innerHTML.replace(/[\u30e3\u30e5\u30e7\u3083\u3085\u3087]/g, '').length;\n\t\tif ( n_moras == pitch_num ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/* Splits tags into separate divs */\n\tfunction splitTagDiv() {\n\t\tconst header = document.getElementsByTagName(\"header\")[0];\n\t\tif (!header) return;\n\t\tconst tags = \"{{MorphManFocus}} {{Tags}}\".split(\" \");\n\t\theader.innerHTML = \"\";\n\n\t\tfor (const tag of tags){\n\t\t\tif (tag.length < 1)\n\t\t\t\tcontinue;\n\t\t\tconst tag_elem = document.createElement(\"div\");\n\t\t\ttag_elem.className = \"tags\";\n\t\t\ttag_elem.innerHTML = tag;\n\t\t\theader.appendChild(tag_elem);\n\t\t}\n\t}\n\n\tdocument.addEventListener('DOMContentLoaded', markPitch(), false);\n\tdocument.addEventListener('DOMContentLoaded', splitTagDiv(), false);\n</script>",
"Back": "<div class=\"fside\">{{FrontSide}}</div>\n<hr id=\"answer\">\n<div class=\"jpsentence\" lang=\"ja\">\n\t{{morphHighlight:furigana:SentFurigana}}\n\t{{^SentFurigana}}{{furigana:SentKanji}}{{/SentFurigana}}\n</div>\n\n{{#SentEng}}\n<details>\n <summary><div class=\"tags\">eng</summary>\n\t<div lang=\"en\">\n\t\t{{SentEng}}\n</div>\n</details>\n{{/SentEng}}\n\n<div class=\"vocab\">\n{{VocabAudio}}{{SentAudio}}\n{{VocabPitchPattern}}{{^VocabPitchPattern}}{{kana:VocabFurigana}}{{/VocabPitchPattern}}\n{{#VocabPitchNum}}<span class=\"tags\" id=\"pitchnum\">{{VocabPitchNum}}</span>{{/VocabPitchNum}}{{#VocabKanji}}\u3010{{kanji:VocabKanji}}\u3011{{/VocabKanji}}\n</div>\n\n{{#VocabDef}}\t\n<div class=\"definitions\">{{furigana:VocabDef}}</div>\n{{/VocabDef}}\n\n{{#Image}}<div class=\"images\" >{{Image}}</div>{{/Image}}\n\n{{#Notes}}\n<details>\n <summary><div class=\"tags\">Notes</summary>\n<div class=\"notes\">\n\t<div>{{furigana:Notes}}</div>\n</div>\n</details>\n{{/Notes}}\n\n<hr>\n\n<footer>{{#SentKanji}}<a \n\thref=\"https://jisho.org/search?keyword={{kanji:text:SentKanji}}\" title=\"Sentence on Jisho\">Jisho</a><a\nhref=\"https://ichi.moe/cl/qr/?q={{kanji:text:SentKanji}} &r=kana\" title=\"Sentence on Ichi.moe\">Ichi.moe</a>{{/SentKanji}}{{#VocabKanji}}<a\n\thref=\"https://www.google.co.jp/search?q={{kanji:text:VocabKanji}}&tbm=isch\" title=\"Search images\">Images</a><a\n\thref=\"http://www.weblio.jp/content/{{text:VocabKanji}}\" title=\"Vocab on Weblio\">Weblio</a><a\n\thref=\"https://sentencesearch.neocities.org/#{{text:VocabKanji}}\" title=\"Vocab on SentenceSearch\">Sentences</a>{{/VocabKanji}}</footer\n>\n\n<script>\n\tfunction removePitchBrackets() {\n\t\tconst tags = document.getElementById(\"pitchnum\");\n\t\tif (tags !== null) {\n\t\t\ttags.innerHTML = tags.innerHTML.replace(/(\\[(?=\\d)|(?<=\\d)\\])/g, \"\");\n\t\t}\n\t}\n\tdocument.addEventListener('DOMContentLoaded', markPitch(), false);\n\tdocument.addEventListener('DOMContentLoaded', removePitchBrackets(), false);\t\n</script>"
},
{
"Name": "Production",
"Front": "{{#MakeProductionCard}}\n{{#SentKanji}}\n\n<header>{{#Tags}}<div class=\"tags\">{{Tags}}</div>{{/Tags}}</header>\n{{#Image}}<div class=\"images\" >{{Image}}</div>{{/Image}}\n<div class=\"jpsentence production\">{{furigana:SentFurigana}}</div>\n<div style=\"text-align: center;\">{{VocabAudio}}{{SentAudio}}</div>\n<script>\n\tdocument.addEventListener('DOMContentLoaded', threeDots(), false);\n\n\tfunction threeDots() {\n\t\tconst sent = document.getElementsByClassName(\"production\")[0];\n\t\tif (sent) {\n\t\t\tconst hidden = sent.getElementsByTagName(\"b\");\n\t\t\tfor (i = 0; i < hidden.length; i++) {\n\t\t\t\tif (hidden[i]) {\n\t\t\t\t\thidden[i].style.visibility = \"visible\";\n\t\t\t\t\t//hidden[i].innerText = \"\u3010{{kana:VocabFurigana}}\u3011\";\n\t\t\t\t\thidden[i].innerText = \"\u3010\"+hidden[i].innerText.replace(/[^\u3041-\u3093\u30a1-\u30f3]/g, \"\")+\"\u3011\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n</script>\n\n{{/SentKanji}}\n{{/MakeProductionCard}}",
"Back": "{{FrontSide}}\n\n<hr>\n\n<div lang=\"en\" >{{SentEng}}</div>\n<div class=\"strokeorder\">{{VocabKanji}}</div>\n\n{{#VocabKanji}}\n\t<div class=\"vocab\">\n\t\t{{VocabPitchPattern}}\n\t\t{{^VocabPitchPattern}}{{kana:VocabFurigana}}{{/VocabPitchPattern}}\n\t\t{{#VocabPitchNum}}\n\t\t\t<span class=\"tags\">{{VocabPitchNum}}</span>\n\t\t{{/VocabPitchNum}}\n\t\t\u3010{{VocabKanji}}\u3011\n\t</div>\n{{/VocabKanji}}\n\n{{#VocabDef}}\t\n\t<div class=\"definitions\">\n\t\t{{furigana:VocabDef}}\n\t</div>\n{{/VocabDef}}\n\n{{#Notes}}\t\n\t<div class=\"notes\">\n\t\t<div class=\"tags\">Notes</div>\n\t\t<div>{{furigana:Notes}}</div>\n\t</div>\n{{/Notes}}\n\n<hr>\n\n<footer>{{#SentKanji}}<a href=\"https://jisho.org/search?keyword={{text:SentKanji}}\" title=\"Sentence on Jisho\">Jisho</a><a href=\"https://www.google.co.jp/search?q={{text:SentKanji}}&tbm=isch\" title=\"Search images\">Images</a>{{/SentKanji}}{{#VocabKanji}}<a href=\"http://tangorin.com/dict.php?dict=general&s={{text:VocabKanji}}\">Tangorin</a><a href=\"http://www.weblio.jp/content/{{text:VocabKanji}}\">Weblio</a><a href=\"https://wadoku.de/search/?q={{text:VocabKanji}}\">Wadoku</a>\t{{/VocabKanji}}</footer>"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB