mirror of
https://github.com/ZetaKebab/japanese-conjugation-drill.git
synced 2025-01-14 22:08:44 +00:00
Added explanations.
This commit is contained in:
parent
eb61b5ed9b
commit
7710459f69
@ -33,6 +33,12 @@ body, input {
|
||||
display: table;
|
||||
}
|
||||
|
||||
#explanation {
|
||||
width: 960px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
#input {
|
||||
background: #eee;
|
||||
width: 100%;
|
||||
@ -117,6 +123,24 @@ table.syllabary td.empty {
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
table.word td {
|
||||
font-size: 36px;
|
||||
color: black;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.word td div:first-child {
|
||||
margin: 0;
|
||||
color: #aaa;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.chart span.change,
|
||||
table.word span.change {
|
||||
color: #f06060;
|
||||
}
|
||||
|
||||
.answer-correct {
|
||||
color: red;
|
||||
}
|
||||
@ -188,3 +212,155 @@ background: yellow;
|
||||
[tooltip]:not([tooltip-persistent]):before {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
div#explanation p span {
|
||||
}
|
||||
|
||||
|
||||
.highlight {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.horizontal-transform {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.horizontal-transform > * {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.transform-arrow {
|
||||
font-size: 32px;
|
||||
color: #888;
|
||||
margin: 16px;
|
||||
}
|
||||
|
||||
|
||||
div.conjugation-chart {
|
||||
border: 2px solid gray;
|
||||
border-radius: 32px;
|
||||
padding: 24px;
|
||||
background: #fff8f0;
|
||||
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
display: table;
|
||||
}
|
||||
|
||||
div.conjugation-chart h2 {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
div.conjugation-chart > * {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.chart + table.chart {
|
||||
margin-left: 32px;
|
||||
}
|
||||
|
||||
table.chart {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.chart td {
|
||||
border: 1px solid gray;
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
background: white;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.chart td.break {
|
||||
height: 1em;
|
||||
border: 0;
|
||||
background: inherit;
|
||||
}
|
||||
|
||||
table.chart th {
|
||||
border: 1px solid gray;
|
||||
background: gray;
|
||||
color: white;
|
||||
}
|
||||
|
||||
table.chart td.title {
|
||||
border: 0;
|
||||
background: inherit;
|
||||
font-size: 22px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.horiz > * {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.rules table.word td {
|
||||
font-size: 24px;
|
||||
color: black;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.rules table.word td div:first-child {
|
||||
margin: 0;
|
||||
color: #aaa;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.rules table.chart span.change {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.rules table.word span.change {
|
||||
color: #f06060;
|
||||
}
|
||||
|
||||
.rules .transform-arrow {
|
||||
font-size: 16px;
|
||||
color: #888;
|
||||
margin: 16px;
|
||||
}
|
||||
|
||||
.brace {
|
||||
fill: none;
|
||||
fill-rule: evenodd;
|
||||
stroke: #ccc;
|
||||
stroke-width: 0.5px;
|
||||
stroke-linecap: butt;
|
||||
stroke-linejoin: miter;
|
||||
stroke-opacity: 1;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
margin-left: 16px;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
.tag {
|
||||
display: inline-block;
|
||||
border-radius: 3px;
|
||||
background: orange;
|
||||
padding-left: 6px;
|
||||
padding-right: 6px;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
.options li {
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.specials {
|
||||
font-weight: bold;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.explain-answer-as-list li {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.explain-answer-as-list {
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
135
conjugation/drill.html
Normal file → Executable file
135
conjugation/drill.html
Normal file → Executable file
@ -1,14 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="drill.css" type="text/css" media="screen"/>
|
||||
<link rel="stylesheet" href="drill.css" type="text/css" media="screen">
|
||||
<link href="https://fonts.googleapis.com/css?family=Amaranth" rel="stylesheet">
|
||||
<script type="text/ecmascript" src="//code.jquery.com/jquery-3.1.1.min.js"></script>
|
||||
<script type="text/ecmascript" src="words.js"></script>
|
||||
<script type="text/ecmascript" src="drill.js"></script>
|
||||
<title>Don's Japanese Conjugation Drill</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="splash">
|
||||
@ -45,6 +47,7 @@
|
||||
<ul>
|
||||
<li><label><input type="checkbox" id="godan" checked> Group 1 verbs</label></li>
|
||||
<li><label><input type="checkbox" id="ichidan" checked> Group 2 verbs</label></li>
|
||||
<div class="specials">Special cases</div>
|
||||
<li><label><input type="checkbox" id="iku" checked> 行く verb</label></li>
|
||||
<li><label><input type="checkbox" id="kuru" checked> 来る verb</label></li>
|
||||
<li><label><input type="checkbox" id="suru" checked> する verbs</label></li>
|
||||
@ -56,6 +59,7 @@
|
||||
<ul>
|
||||
<li><label><input type="checkbox" id="i-adjective"> い adjectives</label></li>
|
||||
<li><label><input type="checkbox" id="na-adjective"> な adjectives</label></li>
|
||||
<div class="specials">Special cases</div>
|
||||
<li><label><input type="checkbox" id="ii"> いい adjective</label></li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -108,119 +112,42 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div id="explanation">
|
||||
<h2>Conjugations for group 1 verbs (godan)</h2>
|
||||
<p>Group 1 (godan) verbs are those that, with a few exceptions, do not
|
||||
end with an いる or える sound.</p>
|
||||
<div style="display: none" id="explanation">
|
||||
|
||||
<table class="syllabary">
|
||||
<h2>Explanation</h2>
|
||||
|
||||
<tr class="あ">
|
||||
<td><div>ぱ</div><div>pa</div></td>
|
||||
<td><div>ば</div><div>ba</div></td>
|
||||
<td><div>だ</div><div>da</div></td>
|
||||
<td><div>ざ</div><div>za</div></td>
|
||||
<td><div>が</div><div>ga</div></td>
|
||||
<td class="empty"></td>
|
||||
<td><div>ん</div><div>n</div></td>
|
||||
<td><div>わ</div><div>wa</div></td>
|
||||
<td><div>ら</div><div>ra</div></td>
|
||||
<td><div>や</div><div>ya</div></td>
|
||||
<td><div>ま</div><div>ma</div></td>
|
||||
<td><div>は</div><div>ha</div></td>
|
||||
<td><div>な</div><div>na</div></td>
|
||||
<td><div>た</div><div>ta</div></td>
|
||||
<td><div>さ</div><div>sa</div></td>
|
||||
<td><div>か</div><div>ka</div></td>
|
||||
<td><div>あ</div><div>a</div></td>
|
||||
</tr>
|
||||
<h3>1. Recognise the given conjugation</h3>
|
||||
|
||||
<tr class="い">
|
||||
<td><div>ぴ</div><div>pi</div></td>
|
||||
<td><div>び</div><div>bi</div></td>
|
||||
<td><div>ぢ</div><div>ji</div></td>
|
||||
<td><div>じ</div><div>ji</div></td>
|
||||
<td><div>ぎ</div><div>gi</div></td>
|
||||
<td class="empty"></td>
|
||||
<td class="empty"></td>
|
||||
<td class="empty"></td>
|
||||
<td><div>り</div><div>ri</div></td>
|
||||
<td class="empty"></td>
|
||||
<td><div>み</div><div>mi</div></td>
|
||||
<td><div>ひ</div><div>hi</div></td>
|
||||
<td><div>に</div><div>ni</div></td>
|
||||
<td><div>ち</div><div>chi</div></td>
|
||||
<td><div>し</div><div>shi</div></td>
|
||||
<td><div>き</div><div>ki</div></td>
|
||||
<td><div>い</div><div>i</div></td>
|
||||
</tr>
|
||||
<p><span id="explain-given"></span> is the <span id="explain-given-tags"></span> form of the <span id="explain-group"></span> <span class="explain-given-dictionary"></span>.</p>
|
||||
|
||||
<tr class="う">
|
||||
<td><div>ぷ</div><div>pu</div></td>
|
||||
<td><div>ぶ</div><div>bu</div></td>
|
||||
<td><div>づ</div><div>zu</div></td>
|
||||
<td><div>ず</div><div>zu</div></td>
|
||||
<td><div>ぐ</div><div>gu</div></td>
|
||||
<td class="empty"></td>
|
||||
<td class="empty"></td>
|
||||
<td class="empty"></td>
|
||||
<td><div>る</div><div>ru</div></td>
|
||||
<td><div>ゆ</div><div>yu</div></td>
|
||||
<td><div>む</div><div>mu</div></td>
|
||||
<td><div>ふ</div><div>fu</div></td>
|
||||
<td><div>ぬ</div><div>nu</div></td>
|
||||
<td><div>つ</div><div>tsu</div></td>
|
||||
<td><div>す</div><div>su</div></td>
|
||||
<td><div>く</div><div>ku</div></td>
|
||||
<td><div>う</div><div>u</div></td>
|
||||
</tr>
|
||||
<h3>2. Change the form</h3>
|
||||
|
||||
<tr class="え">
|
||||
<td><div>ぺ</div><div>pe</div></td>
|
||||
<td><div>べ</div><div>be</div></td>
|
||||
<td><div>で</div><div>de</div></td>
|
||||
<td><div>ぜ</div><div>ze</div></td>
|
||||
<td><div>げ</div><div>ge</div></td>
|
||||
<td class="empty"></td>
|
||||
<td class="empty"></td>
|
||||
<td class="empty"></td>
|
||||
<td><div>れ</div><div>re</div></td>
|
||||
<td class="empty"></td>
|
||||
<td><div>め</div><div>me</div></td>
|
||||
<td><div>へ</div><div>he</div></td>
|
||||
<td><div>ね</div><div>ne</div></td>
|
||||
<td><div>て</div><div>te</div></td>
|
||||
<td><div>せ</div><div>se</div></td>
|
||||
<td><div>け</div><div>ke</div></td>
|
||||
<td><div>え</div><div>e</div></td>
|
||||
</tr>
|
||||
<div class="explain-answer-single">
|
||||
<p class="explain-no-trick">The answer is the <span class="explain-answer-tags"></span> form of the word because the question asked for the <span class="highlight"><span class="explain-transform"></span></span> version.</p>
|
||||
<p class="explain-trick">The question asked for the <span class="highlight"><span class="explain-transform"></span></span> version. However, this was already the case and so it was a trick question.</p>
|
||||
</div>
|
||||
|
||||
<tr class="お">
|
||||
<td><div>ぽ</div><div>po</div></td>
|
||||
<td><div>ぼ</div><div>bo</div></td>
|
||||
<td><div>ど</div><div>do</div></td>
|
||||
<td><div>ぞ</div><div>zo</div></td>
|
||||
<td><div>ご</div><div>go</div></td>
|
||||
<td class="empty"></td>
|
||||
<td class="empty"></td>
|
||||
<td><div>を</div><div>o</div></td>
|
||||
<td><div>ろ</div><div>ro</div></td>
|
||||
<td><div>よ</div><div>yo</div></td>
|
||||
<td><div>も</div><div>mo</div></td>
|
||||
<td><div>ほ</div><div>ho</div></td>
|
||||
<td><div>の</div><div>no</div></td>
|
||||
<td><div>と</div><div>to</div></td>
|
||||
<td><div>そ</div><div>so</div></td>
|
||||
<td><div>こ</div><div>ko</div></td>
|
||||
<td><div>お</div><div>o</div></td>
|
||||
</tr>
|
||||
<div class="explain-answer-multiple">
|
||||
<p class="explain-no-trick">The answers are the <span class="explain-answer-tags"></span> forms of the word because the question asked for a <span class="highlight"><span class="explain-transform"></span></span> version.</p>
|
||||
<p class="explain-trick">The question asked for a <span class="highlight"><span class="explain-transform"></span></span> form of the word. However, this was already the case and so it was a trick question.</p>
|
||||
</div>
|
||||
|
||||
</table>
|
||||
<h3>3. Produce the required conjugation</h3>
|
||||
|
||||
<p class="explain-answer-single">The correct answer is the
|
||||
<span class="explain-answer-tags2"></span> form: <span class="explain-answer"></span>
|
||||
</p>
|
||||
|
||||
<div class="explain-answer-multiple">
|
||||
<p>
|
||||
The possible correct answers are the <span class="explain-answer-tags2"></span> forms:
|
||||
</p>
|
||||
<ul class="explain-answer-as-list"></ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
-->
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@ -180,8 +180,6 @@ function resetLog() {
|
||||
log = { "history": [] };
|
||||
}
|
||||
|
||||
function getVerbForms(entry) {
|
||||
|
||||
function kanaForm(words) {
|
||||
|
||||
if (words.constructor !== Array) {
|
||||
@ -200,6 +198,8 @@ function getVerbForms(entry) {
|
||||
return words.map(function (word) { return word.split(/(.)\[[^\]]*\]/).join(""); } );
|
||||
}
|
||||
|
||||
function getVerbForms(entry) {
|
||||
|
||||
var result = {
|
||||
"kanji": {},
|
||||
"hiragana": {},
|
||||
@ -395,24 +395,93 @@ function generateQuestion() {
|
||||
var kanaForms = forms["hiragana"];
|
||||
var furiganaForms = forms["furigana"];
|
||||
|
||||
var question = "What is the " + transformation.phrase + " form of " +
|
||||
wordWithFurigana(furiganaForms[from_form]).randomElement() + "?";
|
||||
var givenWord = wordWithFurigana(furiganaForms[from_form]).randomElement();
|
||||
|
||||
var question = "What is the " + transformation.phrase + " version of " +
|
||||
givenWord + "?";
|
||||
|
||||
var answer = kanjiForms[to_form];
|
||||
var answer2 = kanaForms[to_form];
|
||||
|
||||
$('#question').html(question);
|
||||
|
||||
window.question = question;
|
||||
window.answer = kanjiForms[to_form];
|
||||
window.answerWithFurigana = wordWithFurigana(furiganaForms[to_form]);
|
||||
window.answer2 = answer2;
|
||||
window.questionData = {
|
||||
entry: entry,
|
||||
transformation: transformation,
|
||||
question: question,
|
||||
answer: kanjiForms[to_form],
|
||||
answer2: answer2,
|
||||
answerWithFurigana: wordWithFurigana(furiganaForms[to_form]),
|
||||
givenWord: givenWord,
|
||||
};
|
||||
|
||||
// Construct the explanation page.
|
||||
|
||||
var data = window.questionData;
|
||||
|
||||
var groupLabels = {
|
||||
"godan" : "godan verb",
|
||||
"ichidan" : "ichidan verb",
|
||||
"iku" : "godan verb",
|
||||
"suru" : "suru verb",
|
||||
"kuru" : "special verb",
|
||||
"i-adjective" : "い adjective",
|
||||
"ii" : "i-adjective",
|
||||
"na-adjective" : "な adjective",
|
||||
};
|
||||
|
||||
var dictionary = words[data.entry].conjugations["dictionary"]
|
||||
|
||||
if (words[data.entry].group == "na-adjective") {
|
||||
dictionary = dictionary.replace(/だ$/, '')
|
||||
}
|
||||
|
||||
dictionary = wordWithFurigana(dictionary);
|
||||
|
||||
$('#explain-given').html(givenWord);
|
||||
$('#explain-given-tags').html(data.transformation.from_tags.map(function (tag) { return "<span class='tag'>" + tag + "</span>"; }).join(" "));
|
||||
$('.explain-given-dictionary').html(dictionary);
|
||||
$('#explain-group').html(groupLabels[words[data.entry].group]);
|
||||
$('.explain-transform').html(data.transformation.phrase);
|
||||
$('.explain-answer-tags').html(data.transformation.to_tags.map(function (tag) { return "<span class='tag'>" + tag + "</span>"; }).join(" "));
|
||||
$('.explain-answer-tags2').html(data.transformation.to_tags.join(" "));
|
||||
$('.explain-answer').html(commaList(questionData.answerWithFurigana, "or"));
|
||||
|
||||
$('.explain-answer-as-list').empty();
|
||||
|
||||
questionData.answerWithFurigana.forEach(function (answer) {
|
||||
console.log("Doing answer");
|
||||
$('.explain-answer-as-list').append("<li>" + answer);
|
||||
});
|
||||
|
||||
if (window.questionData.transformation.tags.indexOf("trick") != -1) {
|
||||
$('.explain-trick').show();
|
||||
$('.explain-no-trick').hide();
|
||||
} else {
|
||||
$('.explain-trick').hide();
|
||||
$('.explain-no-trick').show();
|
||||
}
|
||||
|
||||
if (data.transformation.to == "dictionary") {
|
||||
$('.explain-hide-end').hide();
|
||||
} else {
|
||||
$('.explain-hide-end').show();
|
||||
}
|
||||
|
||||
if (data.answer.length == 1) {
|
||||
$('.explain-answer-single').show();
|
||||
$('.explain-answer-multiple').hide();
|
||||
} else {
|
||||
$('.explain-answer-single').hide();
|
||||
$('.explain-answer-multiple').show();
|
||||
}
|
||||
|
||||
$('#next').prop('disabled', true);
|
||||
$('#response').html("");
|
||||
$('#message').html("");
|
||||
|
||||
$('#proceed').hide();
|
||||
$('#explanation').hide();
|
||||
$('#input').show();
|
||||
$('#answer').focus();
|
||||
|
||||
@ -421,20 +490,21 @@ function generateQuestion() {
|
||||
|
||||
function processAnswer() {
|
||||
|
||||
var questionData = window.questionData;
|
||||
var response = $('#answer').val().trim();
|
||||
|
||||
if (response == "")
|
||||
return;
|
||||
|
||||
var correct = ((window.answer.indexOf(response) != -1) || (window.answer2.indexOf(response) != -1));
|
||||
var correct = ((questionData.answer.indexOf(response) != -1) || (questionData.answer2.indexOf(response) != -1));
|
||||
|
||||
var klass = correct ? "correct" : "incorrect";
|
||||
|
||||
log.history.push({
|
||||
"question": window.question,
|
||||
"question": questionData.question,
|
||||
"response": response,
|
||||
"answer": window.answerWithFurigana,
|
||||
"kana": window.answer2,
|
||||
"answer": questionData.answerWithFurigana,
|
||||
"kana": questionData.answer2,
|
||||
"correct": correct
|
||||
});
|
||||
|
||||
@ -445,11 +515,12 @@ function processAnswer() {
|
||||
if (correct) {
|
||||
$('#message').html("");
|
||||
} else {
|
||||
$('#message').html("<div>The correct answer was " + commaList(window.answerWithFurigana, "or") + "</div>");
|
||||
$('#message').html("<div>The correct answer was " + commaList(questionData.answerWithFurigana, "or") + " <input type='button' value='Explain' onclick='explain()'></div>");
|
||||
}
|
||||
|
||||
$('#input').hide();
|
||||
$('#proceed').show();
|
||||
$('#explanation').hide();
|
||||
$('#proceed button').focus();
|
||||
|
||||
updateHistoryView(log);
|
||||
@ -567,7 +638,7 @@ function calculateTransitions() {
|
||||
tags = tags.split(" ");
|
||||
|
||||
if (tags.indexOf("polite") == -1) {
|
||||
tags.push("plain");
|
||||
tags.splice(0, 0, "plain");
|
||||
}
|
||||
|
||||
if (tags.indexOf("dictionary") != -1) {
|
||||
@ -613,8 +684,9 @@ function calculateTransitions() {
|
||||
|
||||
transformation.phrase = phrase;
|
||||
|
||||
transformation.from_tags = calculateTags(transformation.from);
|
||||
transformation.to_tags = calculateTags(transformation.to);
|
||||
transformation.tags = arrayUnique(calculateTags(transformation.from).concat(calculateTags(transformation.to)));
|
||||
|
||||
});
|
||||
|
||||
// Add trick forms
|
||||
@ -626,6 +698,8 @@ function calculateTransitions() {
|
||||
from: transformation.to,
|
||||
to: transformation.to,
|
||||
phrase: transformation.phrase,
|
||||
from_tags: transformation.to_tags,
|
||||
to_tags: transformation.to_tags,
|
||||
tags: transformation.tags.concat(["trick"])
|
||||
});
|
||||
});
|
||||
@ -655,6 +729,10 @@ function updateOptionSummary() {
|
||||
$("#questionCount").text(applicable);
|
||||
}
|
||||
|
||||
function explain() {
|
||||
$('#explanation').show();
|
||||
}
|
||||
|
||||
function getOptions() {
|
||||
|
||||
var options = ["plain", "polite", "negative", "past", "te-form",
|
||||
|
Loading…
Reference in New Issue
Block a user