Changed transformation data structure.

This commit is contained in:
doncr 2017-03-18 19:25:26 +00:00
parent 2a2a765a25
commit ece55f5435

View File

@ -812,224 +812,639 @@ var words = {
}, },
}; };
var transformations = { var transformations = [
"plain" : { {
from: "negative",
"negative": "affirmative", to: "plain",
"past": "present", phrase: "affirmative"
"polite": "plain",
"te-form": "plain",
"potential": "plain",
"imperative": "plain",
"causative": "plain",
"passive": "plain",
"progressive" : "non-progressive",
}, },
"negative": { {
from: "negative",
"plain": "negative", to: "plain",
"past negative": "present", phrase: "affirmative"
"polite negative": "plain",
"te-form negative": "plain",
"potential negative": "plain",
"imperative negative": "plain",
"causative negative": "plain",
"passive negative": "plain",
"progressive negative": "non-progressive",
}, },
"past" : { {
from: "past",
"plain": "past", to: "plain",
"past negative" : "affirmative", phrase: "present"
"polite past": "plain",
"progressive past": "non-progressive",
}, },
"past negative" : { {
from: "polite",
"negative": "past", to: "plain",
"past": "negative", phrase: "plain"
"polite past negative": "plain",
"progressive past negative": "non-progressive",
}, },
"polite": { {
from: "te-form",
"plain": "polite", to: "plain",
"polite past": "present", phrase: "plain"
"polite negative": "affirmative",
"polite progressive": "non-progressive",
}, },
"polite past": { {
from: "potential",
"past": "polite", to: "plain",
"polite": "past", phrase: "plain"
"polite past negative": "affirmative",
"polite progressive past": "non-progressive",
}, },
"polite negative": { {
from: "imperative",
"negative": "polite", to: "plain",
"polite": "negative", phrase: "plain"
"polite past negative": "present",
"polite progressive negative": "non-progressive",
}, },
"polite past negative": { {
from: "causative",
"past negative": "polite", to: "plain",
"polite past": "negative", phrase: "plain"
"polite negative": "past",
"polite progressive past negative": "non-progressive",
}, },
"te-form" : { {
from: "passive",
"plain" : "て", to: "plain",
"te-form negative" : "affirmative", phrase: "plain"
}, },
"te-form negative" : { {
from: "progressive" ,
"te-form" : "negative", to: "plain",
"negative" : "て", phrase: "non-progressive"
}, },
"potential" : { {
from: "plain",
"plain" : "potential", to: "negative",
"potential negative" : "affirmative", phrase: "negative"
}, },
"potential negative" : { {
from: "past negative",
"potential" : "negative", to: "negative",
"negative" : "potential", phrase: "present"
}, },
"imperative" : { {
from: "polite negative",
"plain" : "imperative", to: "negative",
"imperative negative" : "affirmative", phrase: "plain"
}, },
"imperative negative" : { {
from: "te-form negative",
"imperative" : "negative", to: "negative",
"negative" : "imperative", phrase: "plain"
}, },
"causative" : { {
from: "potential negative",
"plain" : "causative", to: "negative",
"causative negative" : "affirmative", phrase: "plain"
"causative passive" : "active",
}, },
"causative negative" : { {
from: "imperative negative",
"causative" : "negative", to: "negative",
"negative" : "causative", phrase: "plain"
"causative passive negative" : "active",
}, },
"passive" : { {
from: "causative negative",
"plain" : "passive", to: "negative",
"passive negative" : "affirmative", phrase: "plain"
"causative passive" : "non-causative",
}, },
"passive negative" : { {
from: "passive negative",
"passive" : "negative", to: "negative",
"negative" : "passive", phrase: "plain"
"causative passive negative" : "non-causative"
}, },
"causative passive" : { {
from: "progressive negative",
"causative" : "passive", to: "negative",
"passive" : "causative", phrase: "non-progressive"
"causative passive negative" : "affirmative",
}, },
"causative passive negative" : { {
from: "plain",
"causative negative" : "passive", to: "past",
"passive negative" : "causative", phrase: "past"
"causative passive" : "negative",
}, },
"progressive" : { {
from: "past negative" ,
"plain": "progressive", to: "past",
"polite progressive": "plain", phrase: "affirmative"
"progressive negative": "affirmative",
"progressive past": "present",
}, },
"progressive negative" : { {
from: "polite past",
"progressive": "negative", to: "past",
"negative": "progressive", phrase: "plain"
"progressive past negative": "present",
"polite progressive negative": "plain",
}, },
"polite progressive" : { {
from: "progressive past",
"progressive": "polite", to: "past",
"polite": "progressive", phrase: "non-progressive"
"polite progressive negative": "affirmative",
"polite progressive past": "present",
}, },
"polite progressive negative" : { {
from: "negative",
"polite progressive": "negative", to: "past negative",
"polite negative": "progressive", phrase: "past"
"progressive negative": "polite",
"polite progressive past negative": "present",
}, },
"progressive past" : { {
from: "past",
"past": "progressive", to: "past negative",
"progressive": "past", phrase: "negative"
"progressive past negative": "affirmative",
"polite progressive past": "plain",
}, },
"progressive past negative" : { {
from: "polite past negative",
"past negative": "progressive", to: "past negative",
"progressive negative": "past", phrase: "plain"
"progressive past": "negative",
"polite progressive past negative": "plain",
}, },
"polite progressive past" : { {
from: "progressive past negative",
"polite past": "progressive", to: "past negative",
"polite progressive" : "past", phrase: "non-progressive"
"progressive past": "polite",
"polite progressive past negative": "affirmative",
}, },
"polite progressive past negative" : { {
from: "plain",
"polite past negative": "progressive", to: "polite",
"progressive past negative": "polite", phrase: "polite"
"polite progressive past": "negative",
"polite progressive negative": "past",
}, },
};
{
from: "polite past",
to: "polite",
phrase: "present"
},
{
from: "polite negative",
to: "polite",
phrase: "affirmative"
},
{
from: "polite progressive",
to: "polite",
phrase: "non-progressive"
},
{
from: "past",
to: "polite past",
phrase: "polite"
},
{
from: "polite",
to: "polite past",
phrase: "past"
},
{
from: "polite past negative",
to: "polite past",
phrase: "affirmative"
},
{
from: "polite progressive past",
to: "polite past",
phrase: "non-progressive"
},
{
from: "negative",
to: "polite negative",
phrase: "polite"
},
{
from: "polite",
to: "polite negative",
phrase: "negative"
},
{
from: "polite past negative",
to: "polite negative",
phrase: "present"
},
{
from: "polite progressive negative",
to: "polite negative",
phrase: "non-progressive"
},
{
from: "past negative",
to: "polite past negative",
phrase: "polite"
},
{
from: "polite past",
to: "polite past negative",
phrase: "negative"
},
{
from: "polite negative",
to: "polite past negative",
phrase: "past"
},
{
from: "polite progressive past negative",
to: "polite past negative",
phrase: "non-progressive"
},
{
from: "plain" ,
to: "te-form",
phrase: "て"
},
{
from: "te-form negative" ,
to: "te-form",
phrase: "affirmative"
},
{
from: "te-form" ,
to: "te-form negative",
phrase: "negative"
},
{
from: "negative" ,
to: "te-form negative",
phrase: "て"
},
{
from: "plain" ,
to: "potential",
phrase: "potential"
},
{
from: "potential negative" ,
to: "potential",
phrase: "affirmative"
},
{
from: "potential" ,
to: "potential negative",
phrase: "negative"
},
{
from: "negative" ,
to: "potential negative",
phrase: "potential"
},
{
from: "plain" ,
to: "imperative",
phrase: "imperative"
},
{
from: "imperative negative" ,
to: "imperative",
phrase: "affirmative"
},
{
from: "imperative" ,
to: "imperative negative",
phrase: "negative"
},
{
from: "negative" ,
to: "imperative negative",
phrase: "imperative"
},
{
from: "plain" ,
to: "causative",
phrase: "causative"
},
{
from: "causative negative" ,
to: "causative",
phrase: "affirmative"
},
{
from: "causative passive" ,
to: "causative",
phrase: "active"
},
{
from: "causative" ,
to: "causative negative",
phrase: "negative"
},
{
from: "negative" ,
to: "causative negative",
phrase: "causative"
},
{
from: "causative passive negative" ,
to: "causative negative",
phrase: "active"
},
{
from: "plain" ,
to: "passive",
phrase: "passive"
},
{
from: "passive negative" ,
to: "passive",
phrase: "affirmative"
},
{
from: "causative passive" ,
to: "passive",
phrase: "non-causative"
},
{
from: "passive" ,
to: "passive negative",
phrase: "negative"
},
{
from: "negative" ,
to: "passive negative",
phrase: "passive"
},
{
from: "causative passive negative" ,
to: "passive negative",
phrase: "non-causative"
},
{
from: "causative" ,
to: "causative passive",
phrase: "passive"
},
{
from: "passive" ,
to: "causative passive",
phrase: "causative"
},
{
from: "causative passive negative" ,
to: "causative passive",
phrase: "affirmative"
},
{
from: "causative negative" ,
to: "causative passive negative",
phrase: "passive"
},
{
from: "passive negative" ,
to: "causative passive negative",
phrase: "causative"
},
{
from: "causative passive" ,
to: "causative passive negative",
phrase: "negative"
},
{
from: "plain",
to: "progressive",
phrase: "progressive"
},
{
from: "polite progressive",
to: "progressive",
phrase: "plain"
},
{
from: "progressive negative",
to: "progressive",
phrase: "affirmative"
},
{
from: "progressive past",
to: "progressive",
phrase: "present"
},
{
from: "progressive",
to: "progressive negative",
phrase: "negative"
},
{
from: "negative",
to: "progressive negative",
phrase: "progressive"
},
{
from: "progressive past negative",
to: "progressive negative",
phrase: "present"
},
{
from: "polite progressive negative",
to: "progressive negative",
phrase: "plain"
},
{
from: "progressive",
to: "polite progressive",
phrase: "polite"
},
{
from: "polite",
to: "polite progressive",
phrase: "progressive"
},
{
from: "polite progressive negative",
to: "polite progressive",
phrase: "affirmative"
},
{
from: "polite progressive past",
to: "polite progressive",
phrase: "present"
},
{
from: "polite progressive",
to: "polite progressive negative",
phrase: "negative"
},
{
from: "polite negative",
to: "polite progressive negative",
phrase: "progressive"
},
{
from: "progressive negative",
to: "polite progressive negative",
phrase: "polite"
},
{
from: "polite progressive past negative",
to: "polite progressive negative",
phrase: "present"
},
{
from: "past",
to: "progressive past",
phrase: "progressive"
},
{
from: "progressive",
to: "progressive past",
phrase: "past"
},
{
from: "progressive past negative",
to: "progressive past",
phrase: "affirmative"
},
{
from: "polite progressive past",
to: "progressive past",
phrase: "plain"
},
{
from: "past negative",
to: "progressive past negative",
phrase: "progressive"
},
{
from: "progressive negative",
to: "progressive past negative",
phrase: "past"
},
{
from: "progressive past",
to: "progressive past negative",
phrase: "negative"
},
{
from: "polite progressive past negative",
to: "progressive past negative",
phrase: "plain"
},
{
from: "polite past",
to: "polite progressive past",
phrase: "progressive"
},
{
from: "polite progressive" ,
to: "polite progressive past",
phrase: "past"
},
{
from: "progressive past",
to: "polite progressive past",
phrase: "polite"
},
{
from: "polite progressive past negative",
to: "polite progressive past",
phrase: "affirmative"
},
{
from: "polite past negative",
to: "polite progressive past negative",
phrase: "progressive"
},
{
from: "progressive past negative",
to: "polite progressive past negative",
phrase: "polite"
},
{
from: "polite progressive past",
to: "polite progressive past negative",
phrase: "negative"
},
{
from: "polite progressive negative",
to: "polite progressive past negative",
phrase: "past"
},
];
var log; var log;
@ -1225,8 +1640,10 @@ function generateQuestion() {
} }
entry = Object.keys(words).randomElement(); entry = Object.keys(words).randomElement();
to_form = Object.keys(transformations).randomElement(); transformation = transformations.randomElement();
from_form = Object.keys(transformations[to_form]).randomElement();
from_form = transformation.from;
to_form = transformation.to;
forms = getVerbForms(entry); forms = getVerbForms(entry);
@ -1261,7 +1678,7 @@ function generateQuestion() {
var kanaForms = forms["hiragana"]; var kanaForms = forms["hiragana"];
var furiganaForms = forms["furigana"]; var furiganaForms = forms["furigana"];
var question = "What is the " + transformations[to_form][from_form] + " form of " + wordWithFurigana(furiganaForms[from_form]) + "?"; var question = "What is the " + transformation.phrase + " form of " + wordWithFurigana(furiganaForms[from_form]) + "?";
var answer = kanjiForms[to_form]; var answer = kanjiForms[to_form];
var answer2 = kanaForms[to_form]; var answer2 = kanaForms[to_form];