diff options
author | Camil Staps | 2020-01-03 19:52:51 +0100 |
---|---|---|
committer | Camil Staps | 2020-01-03 19:52:51 +0100 |
commit | 6dad83eef5609772d603befc21eab3069802c1a7 (patch) | |
tree | 64eb29ba87c4829e3fbd0b8148d5162635d31f20 | |
parent | Strip down for simple app for Greek verb λύω (diff) |
Use Act, Med, Pass, and Med-pass as abbreviations for voice
-rw-r--r-- | public/js/luoparsetrainer.js | 54 | ||||
-rw-r--r-- | resources/views/trainer.blade.php | 2 |
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/> |