aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/js/luoparsetrainer.js54
-rw-r--r--resources/views/trainer.blade.php2
2 files changed, 30 insertions, 26 deletions
diff --git a/public/js/luoparsetrainer.js b/public/js/luoparsetrainer.js
index 11394e4..3d709ac 100644
--- a/public/js/luoparsetrainer.js
+++ b/public/js/luoparsetrainer.js
@@ -57,10 +57,10 @@ $(document).ready(function(){
, 'inf ': 'Infinitivus'
}; break;
case 2:
- buts = { 'A ': 'Activum'
- , 'M ': 'Medium'
- , 'P ': 'Passivum'
- , 'MP ': 'Medio-passivum'
+ buts = { 'Act ': 'Activum'
+ , 'Med ': 'Medium'
+ , 'Pass ': 'Passivum'
+ , 'Med-pass ': 'Medio-passivum'
}; break;
case 3:
if (val.match(/ inf /)) {
@@ -143,16 +143,10 @@ $(document).ready(function(){
function addInput() {
input_count++;
var html = "<div class='row trainer-input'>\
- <div class='col-md-8'>\
+ <div class='col-md-12'>\
<div class='form-group'>\
- <label for='trainer-input-"+input_count+"'>Parse:</label>\
- <input type='text' class='form-control' id='trainer-input-"+input_count+"' placeholder='pr ind A 1 ev' spellcheck='false'/>\
- </div>\
- </div>\
- <div class='col-md-4'>\
- <div class='form-group'>\
- <label for='trainer-parsed-"+input_count+"'>Interpreted as:</label>\
- <input type='text' class='form-control' id='trainer-parsed-"+input_count+"' readonly='readonly'/>\
+ <label for='trainer-input-"+input_count+"'>Determineer:</label>\
+ <input type='text' class='form-control' id='trainer-input-"+input_count+"' placeholder='Bijvoorbeeld: pr ind Act 1 ev' spellcheck='false'/>\
</div>\
</div>\
</div>";
@@ -255,19 +249,30 @@ $(document).ready(function(){
}
}
+ function findVoice(voice) {
+ switch (voice) {
+ case 'Act': return 'A';
+ case 'Med': return 'M';
+ case 'Pass': return 'P';
+ case 'Med-pass': return 'MP';
+ default: return undefined;
+ }
+ }
+
function parseAnswer(parsing) {
- var match = parsing.match(/^\s*(pr|impf|aor|fut|pf|pqpf)\s+(ind|conj|opt|imp!)\s+(A|M|P|MP)\s+([123])\s*([em]v)\s*$/);
+ var match = parsing.match(/^\s*(pr|impf|aor|fut|pf|pqpf)\s+(ind|conj|opt|imp!)\s+(Act|Med|Pass|Med-pass)\s+([123])\s*([em]v)\s*$/);
if (match) {
var tense = findTense(match[1]);
var mode = findMode(match[2]);
+ var voice = findVoice(match[3]);
- if (typeof tense=='undefined' || typeof mode=='undefined')
+ if (typeof tense=='undefined' || typeof mode=='undefined' || typeof voice=='undefined')
return false;
return {
tense: tense,
mode: mode,
- voice: match[3],
+ voice: voice,
person: match[4],
gender: null,
number: match[5] == 'ev' ? 'sg' : 'pl',
@@ -275,17 +280,18 @@ $(document).ready(function(){
};
}
- match = parsing.match(/^\s*(pr|impf|aor|fut|pf|pqpf)\s+ptc\s+(A|M|P|MP)\s+([MFN])\s+(nom|gen|dat|acc)\s+([em]v)\s*$/);
+ match = parsing.match(/^\s*(pr|impf|aor|fut|pf|pqpf)\s+ptc\s+(Act|Med|Pass|Med-pass)\s+([MFN])\s+(nom|gen|dat|acc)\s+([em]v)\s*$/);
if (match) {
var tense = findTense(match[1]);
+ var voice = findVoice(match[2]);
- if (typeof tense=='undefined')
+ if (typeof tense=='undefined' || typeof voice=='undefined')
return false;
return {
tense: tense,
mode: 'participium',
- voice: match[2],
+ voice: voice,
person: null,
gender: match[3],
number: match[5] == 'ev' ? 'sg' : 'pl',
@@ -293,17 +299,18 @@ $(document).ready(function(){
};
}
- match = parsing.match(/^\s*(pr|impf|aor|fut|pf|pqpf)\s+inf\s+(A|M|P|MP)\s*$/);
+ match = parsing.match(/^\s*(pr|impf|aor|fut|pf|pqpf)\s+inf\s+(Act|Med|Pass|Med-pass)\s*$/);
if (match) {
var tense = findTense(match[1]);
+ var voice = findVoice(match[2]);
- if (typeof tense=='undefined')
+ if (typeof tense=='undefined' || typeof voice=='undefined')
return false;
return {
tense: tense,
mode: 'infinitivus',
- voice: match[2],
+ voice: voice,
person: null,
gender: null,
number: null,
@@ -353,11 +360,8 @@ $(document).ready(function(){
var answer = parseAnswer(input.val());
if (answer === false) {
input.parent().addClass('has-error');
- $('#trainer-parsed-' + input_count).val(
- input.val().length < 10 ? 'Vul een volledige parsering in...' : 'Incorrecte invoer');
} else {
input.parent().removeClass('has-error');
- $('#trainer-parsed-' + input_count).val(parsingToString(answer, true));
}
return answer;
}
diff --git a/resources/views/trainer.blade.php b/resources/views/trainer.blade.php
index c73dcd3..0dad78c 100644
--- a/resources/views/trainer.blade.php
+++ b/resources/views/trainer.blade.php
@@ -54,7 +54,7 @@ use HebrewParseTrainer\Tense;
<p>
<strong>Tempora</strong> (tijden): gebruik de afkortingen pr(aesens), imp(er)f(ectum), aor(istus), fut(urum), p(er)f(ectum) en p(lus)q(uam)p(er)f(ectum).<br/>
<strong>Modi</strong> (wijzen): ind(icativus), conj(unctivus), opt(ativus), imp!(erativus), p(ar)t(i)c(ipium), inf(initivus).<br/>
- <strong>Genera</strong>: A(ctivum), M(edium), P(assivum), M(edio-)P(assivum).<br/>
+ <strong>Genera</strong>: Act(ivum), Med(ium), Pass(ivum), Med(io)-Pass(ivum) (als Medium en Passivum samenvallen).<br/>
<strong>Persoon</strong> (indien van toepassing): 1, 2 of 3.<br/>
<strong>Geslacht</strong> (indien van toepassing): M(asculinum), F(eminimum), N(eutrum).<br/>
<strong>Naamval</strong> (indien van toepassing): nom(inativus), gen(itivus), dat(ivus), acc(usativus).<br/>