aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Readme.md4
-rw-r--r--app/Form.php (renamed from app/Root.php)19
-rw-r--r--app/Http/Controllers/Auth/ForgotPasswordController.php32
-rw-r--r--app/Http/Controllers/Auth/LoginController.php39
-rw-r--r--app/Http/Controllers/Auth/RegisterController.php76
-rw-r--r--app/Http/Controllers/Auth/ResetPasswordController.php34
-rw-r--r--app/Http/Controllers/FormController.php (renamed from app/Http/Controllers/RandomVerbController.php)30
-rw-r--r--app/Http/Controllers/RootController.php58
-rw-r--r--app/Http/Controllers/VerbController.php161
-rw-r--r--app/Mode.php (renamed from app/RootKind.php)10
-rw-r--r--app/PointChange.php35
-rw-r--r--app/RandomLog.php4
-rw-r--r--app/RootTranslation.php29
-rw-r--r--app/Stem.php29
-rw-r--r--app/Tense.php4
-rw-r--r--app/User.php56
-rw-r--r--app/Verb.php71
-rw-r--r--app/VerbAction.php41
-rw-r--r--composer.json6
-rw-r--r--database/factories/ModelFactory.php23
-rw-r--r--database/migrations/2016_01_04_143639_create_modes_table.php (renamed from database/migrations/2016_01_04_143639_create_stems_table.php)11
-rw-r--r--database/migrations/2016_01_04_143647_create_tenses_table.php4
-rw-r--r--database/migrations/2016_01_04_143655_create_roots_table.php48
-rw-r--r--database/migrations/2016_01_04_143702_create_forms_table.php (renamed from database/migrations/2016_01_04_143702_create_verbs_table.php)26
-rw-r--r--database/migrations/2016_01_04_144049_create_root_translations_table.php52
-rw-r--r--database/migrations/2016_05_10_211558_create_random_logs_table.php2
-rw-r--r--database/migrations/2016_09_04_081740_create_users_table.php33
-rw-r--r--database/migrations/2016_09_04_081754_create_verb_actions_table.php38
-rw-r--r--database/migrations/2016_09_04_081811_create_point_changes_table.php37
-rw-r--r--database/migrations/2016_09_04_081924_add_active_to_verbs.php31
-rw-r--r--database/migrations/2016_09_05_215803_create_root_kinds.php45
-rw-r--r--database/migrations/2016_09_05_230150_add_isadmin_to_users.php28
-rw-r--r--database/migrations/2016_09_25_210947_add_remember_token.php32
-rw-r--r--database/migrations/2016_09_25_230620_create_password_resets_table.php32
-rw-r--r--database/seeds/BasisTableSeeder.php46
-rw-r--r--database/seeds/DatabaseSeeder.php7
-rw-r--r--database/seeds/FormTableSeeder.php (renamed from app/Observers/UserObserver.php)29
-rw-r--r--database/seeds/RootTableSeeder.php53
-rw-r--r--database/seeds/VerbTableSeeder.php59
-rw-r--r--public/css/fonts/EzraSIL.ttfbin155584 -> 0 bytes
-rw-r--r--public/css/fonts/SBL_grk.ttfbin0 -> 1123080 bytes
-rw-r--r--public/css/luoparsetrainer.css (renamed from public/css/hebrewparsetrainer.css)24
-rw-r--r--public/js/alerts.js11
-rw-r--r--public/js/luoparsetrainer.js (renamed from public/js/hebrewparsetrainer.js)286
-rw-r--r--public/js/moderators.js118
-rw-r--r--resources/views/add_root.blade.php29
-rw-r--r--resources/views/auth/login.blade.php68
-rw-r--r--resources/views/auth/passwords/email.blade.php47
-rw-r--r--resources/views/auth/passwords/reset.blade.php70
-rw-r--r--resources/views/auth/register.blade.php82
-rw-r--r--resources/views/contribute.blade.php53
-rw-r--r--resources/views/layouts/master.blade.php40
-rw-r--r--resources/views/mails/user/create.blade.php13
-rw-r--r--resources/views/shared/already_logged_in.blade.php1
-rw-r--r--resources/views/shared/messages.blade.php5
-rw-r--r--resources/views/stats.blade.php134
-rw-r--r--resources/views/suggest.blade.php89
-rw-r--r--resources/views/suggestions.blade.php43
-rw-r--r--resources/views/trainer.blade.php70
-rw-r--r--resources/views/user/create.blade.php32
-rw-r--r--resources/views/user/top.blade.php39
-rw-r--r--routes/web.php30
-rwxr-xr-xtools/import_etcbc.py140
63 files changed, 319 insertions, 2479 deletions
diff --git a/Readme.md b/Readme.md
index 0da38a5..e725a29 100644
--- a/Readme.md
+++ b/Readme.md
@@ -102,7 +102,7 @@ In a subdirectory, we need to enforce trailing slashes and do some special thing
Copyright 2015–present Camil Staps.
Licensed under GPL v3.0, see the LICENSE file.
-This project uses the [EzraSIL][ezrasil] font which is licensed under the Open Font License.
+This project uses the [SBL Greek][sblgrk] font which is licensed under the SBL Font User Agreement.
[demo]: https://parse.hebrewtools.org/
-[ezrasil]: http://scripts.sil.org/cms/scripts/page.php?item_id=EzraSIL_Home
+[ezrasil]: https://www.sbl-site.org/educational/biblicalfonts.aspx
diff --git a/app/Root.php b/app/Form.php
index 4e5e9df..767c122 100644
--- a/app/Root.php
+++ b/app/Form.php
@@ -1,7 +1,7 @@
<?php
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,18 +20,17 @@ namespace HebrewParseTrainer;
use Illuminate\Database\Eloquent\Model;
-class Root extends Model {
+class Form extends Model {
- protected $table = 'roots';
+ protected $table = 'forms';
public $timestamps = false;
- protected $fillable = ['root', 'root_kind_id'];
+ protected $fillable = ['form', 'tense', 'mode', 'voice', 'person', 'number', 'gender', 'case'];
- public function kind() {
- return $this->belongsTo('HebrewParseTrainer\RootKind', 'root_kind_id');
- }
+ const ACCEPTED_VOTE_COUNT = 5;
- public function verbs() {
- return $this->hasMany('HebrewParseTrainer\Verb', 'root', 'root');
+ public function otherParsings() {
+ return self::where('form', $this->form)->get()
+ ->filter(function($v){return $v->form === $this->form;});
}
}
diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php
deleted file mode 100644
index a36a6f4..0000000
--- a/app/Http/Controllers/Auth/ForgotPasswordController.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Auth;
-
-use App\Http\Controllers\Controller;
-use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
-
-class ForgotPasswordController extends Controller
-{
- /*
- |--------------------------------------------------------------------------
- | Password Reset Controller
- |--------------------------------------------------------------------------
- |
- | This controller is responsible for handling password reset emails and
- | includes a trait which assists in sending these notifications from
- | your application to your users. Feel free to explore this trait.
- |
- */
-
- use SendsPasswordResetEmails;
-
- /**
- * Create a new controller instance.
- *
- * @return void
- */
- public function __construct()
- {
- $this->middleware('guest');
- }
-}
diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php
deleted file mode 100644
index 4c81bea..0000000
--- a/app/Http/Controllers/Auth/LoginController.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Auth;
-
-use App\Http\Controllers\Controller;
-use Illuminate\Foundation\Auth\AuthenticatesUsers;
-
-class LoginController extends Controller
-{
- /*
- |--------------------------------------------------------------------------
- | Login Controller
- |--------------------------------------------------------------------------
- |
- | This controller handles authenticating users for the application and
- | redirecting them to your home screen. The controller uses a trait
- | to conveniently provide its functionality to your applications.
- |
- */
-
- use AuthenticatesUsers;
-
- /**
- * Where to redirect users after login.
- *
- * @var string
- */
- protected $redirectTo = '/contribute';
-
- /**
- * Create a new controller instance.
- *
- * @return void
- */
- public function __construct()
- {
- $this->middleware('guest', ['except' => 'logout']);
- }
-}
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
deleted file mode 100644
index 29ec08a..0000000
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Auth;
-
-use HebrewParseTrainer\User;
-use Validator;
-use App\Http\Controllers\Controller;
-use Illuminate\Foundation\Auth\RegistersUsers;
-
-class RegisterController extends Controller
-{
- /*
- |--------------------------------------------------------------------------
- | Register Controller
- |--------------------------------------------------------------------------
- |
- | This controller handles the registration of new users as well as their
- | validation and creation. By default this controller uses a trait to
- | provide this functionality without requiring any additional code.
- |
- */
-
- use RegistersUsers;
-
- /**
- * Where to redirect users after login / registration.
- *
- * @var string
- */
- protected $redirectTo = '/';
-
- /**
- * Create a new controller instance.
- *
- * @return void
- */
- public function __construct()
- {
- $this->middleware('guest');
- }
-
- /**
- * Get a validator for an incoming registration request.
- *
- * @param array $data
- * @return \Illuminate\Contracts\Validation\Validator
- */
- protected function validator(array $data)
- {
- return Validator::make($data, [
- 'name' => 'required|max:255',
- 'email' => 'required|email|max:255|unique:users',
- 'password' => 'required|min:6|confirmed',
- ]);
- }
-
- /**
- * Create a new user instance after a valid registration.
- *
- * @param array $data
- * @return User
- */
- protected function create(array $data)
- {
- $user = new User([
- 'name' => $data['name'],
- 'email' => $data['email'],
- ]);
-
- $user->password = bcrypt($data['password']);
-
- $user->save();
-
- return $user;
- }
-}
diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php
deleted file mode 100644
index 98d1131..0000000
--- a/app/Http/Controllers/Auth/ResetPasswordController.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Auth;
-
-use App\Http\Controllers\Controller;
-use Illuminate\Foundation\Auth\ResetsPasswords;
-
-class ResetPasswordController extends Controller
-{
- /*
- |--------------------------------------------------------------------------
- | Password Reset Controller
- |--------------------------------------------------------------------------
- |
- | This controller is responsible for handling password reset requests
- | and uses a simple trait to include this behavior. You're free to
- | explore this trait and override any methods you wish to tweak.
- |
- */
-
- use ResetsPasswords;
-
- protected $redirectTo = '/';
-
- /**
- * Create a new controller instance.
- *
- * @return void
- */
- public function __construct()
- {
- $this->middleware('guest');
- }
-}
diff --git a/app/Http/Controllers/RandomVerbController.php b/app/Http/Controllers/FormController.php
index ceb5ff9..a860363 100644
--- a/app/Http/Controllers/RandomVerbController.php
+++ b/app/Http/Controllers/FormController.php
@@ -1,7 +1,7 @@
<?php
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,31 +18,33 @@
*/
namespace App\Http\Controllers;
-use HebrewParseTrainer\Verb;
+use HebrewParseTrainer\Form;
use HebrewParseTrainer\RandomLog;
+
use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input;
+use Illuminate\Support\Facades\Validator;
-class RandomVerbController extends Controller {
+class FormController extends Controller {
- public function show()
- {
- $verbs = Verb::all();
+ public function random() {
+ $forms = Form::all();
foreach (Input::get() as $col => $val) {
- $val = explode(',', $val);
- $verbs = $verbs->filter(function(Verb $item) use ($col, $val) {
- return in_array($item->getAttribute($col), $val);
- });
+ if ($col == '_token')
+ continue;
+ $vals = explode(',', $val);
+ $forms = $forms->whereIn($col, $vals);
}
- $verb = $verbs->random();
+ $form = $forms->random();
$log = new RandomLog();
$log->request = json_encode(Input::get());
- $log->response = $verb->id;
+ $log->response = $form->id;
$log->ip = $_SERVER['REMOTE_ADDR'];
$log->save();
- $obj = ['verb' => $verb, 'answers' => $verb->otherParsings()];
+ $obj = ['form' => $form, 'answers' => $form->otherParsings()];
return response()->json($obj);
}
diff --git a/app/Http/Controllers/RootController.php b/app/Http/Controllers/RootController.php
deleted file mode 100644
index 5546a1d..0000000
--- a/app/Http/Controllers/RootController.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-namespace App\Http\Controllers;
-
-use Illuminate\Http\Request;
-use Illuminate\Support\Facades\Auth;
-use Illuminate\Support\Facades\Validator;
-
-use HebrewParseTrainer\Root;
-use HebrewParseTrainer\RootKind;
-
-class RootController extends Controller {
-
- public function create(Request $request) {
- $_kinds = RootKind::all();
- $kinds = [];
- foreach ($_kinds as $kind)
- $kinds[] = $kind->id;
-
- $validator = Validator::make($request->input(), [
- 'root' => 'required',
- 'root_kind_id' => 'in:' . implode(',', $kinds),
- ]);
-
- if ($validator->fails()) {
- return [
- 'success' => false,
- 'message' => $validator->errors()->first()
- ];
- }
-
- $root = new Root;
- $root->root = $request->input('root');
- $root->root_kind_id = $request->input('root_kind_id');
- $root->save();
-
- return [
- 'success' => true,
- ];
- }
-
-}
diff --git a/app/Http/Controllers/VerbController.php b/app/Http/Controllers/VerbController.php
deleted file mode 100644
index 042bfe2..0000000
--- a/app/Http/Controllers/VerbController.php
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-namespace App\Http\Controllers;
-
-use HebrewParseTrainer\PointChange;
-use HebrewParseTrainer\Stem;
-use HebrewParseTrainer\Tense;
-use HebrewParseTrainer\Verb;
-use HebrewParseTrainer\VerbAction;
-use HebrewParseTrainer\RandomLog;
-
-use Illuminate\Http\Request;
-use Illuminate\Support\Facades\Auth;
-use Illuminate\Support\Facades\Input;
-use Illuminate\Support\Facades\Validator;
-
-class VerbController extends Controller {
-
- public function random() {
- $verbs = Verb::where('active', 1);
- foreach (Input::get() as $col => $val) {
- if ($col == '_token')
- continue;
- $vals = explode(',', $val);
- $verbs = $verbs->whereIn($col, $vals);
- }
- $verb = $verbs->get()->random();
-
- $log = new RandomLog();
- $log->request = json_encode(Input::get());
- $log->response = $verb->id;
- $log->ip = $_SERVER['REMOTE_ADDR'];
- $log->save();
-
- $obj = ['verb' => $verb, 'answers' => $verb->otherParsings()];
- return response()->json($obj);
- }
-
- public function suggest(Request $request) {
- $_tenses = Tense::all();
- $tenses = [];
- foreach ($_tenses as $tense)
- $tenses[] = $tense->name;
-
- $_stems = Stem::all();
- $stems = [];
- foreach ($_stems as $stem)
- $stems[] = $stem->name;
-
- $validator = Validator::make($request->input(), [
- 'verb' => 'required',
- 'root' => 'required',
- 'stem' => 'in:' . implode(',', $stems),
- 'tense' => 'in:' . implode(',', $tenses),
- 'person' => 'in:,1,2,3',
- 'gender' => 'in:,m,f',
- 'number' => 'in:,s,p',
- ]);
-
- if ($validator->fails()) {
- return [
- 'success' => false,
- 'message' => $validator->errors()->first()
- ];
- }
-
- $verb = new Verb;
- $verb->verb = $request->input('verb');
- $verb->root = $request->input('root');
- $verb->stem = $request->input('stem');
- $verb->tense = $request->input('tense');
- $verb->person = $request->input('person') ? $request->input('person') : null;
- $verb->gender = $request->input('gender') ? $request->input('gender') : null;
- $verb->number = $request->input('number') ? $request->input('number') : null;
- $verb->active = 0;
- $verb->save();
-
- $action = new VerbAction;
- $action->kind = VerbAction::KIND_SUGGEST;
- $action->user_id = Auth::user()->id;
- $action->verb_id = $verb->id;
- $action->save();
-
- $this->vote(1, $verb->id);
-
- return [
- 'success' => true,
- 'id' => $verb->id,
- 'accepted' => $verb->active != 0
- ];
- }
-
- protected function checkAccept($verb) {
- if ($verb->voteCount() < Verb::ACCEPTED_VOTE_COUNT)
- return false;
-
- $verb->active = 1;
- $verb->save();
-
- if (!is_null($user = $verb->suggestedBy())) {
- $ptchange = new PointChange;
- $ptchange->kind = PointChange::KIND_SUGGESTION_ACCEPTED;
- $ptchange->change = PointChange::POINTS_SUGGESTION_ACCEPTED;
- $ptchange->user_id = $user->id;
- $ptchange->verb_id = $verb->id;
- $ptchange->save();
-
- $user->points += PointChange::POINTS_SUGGESTION_ACCEPTED;
- $user->save();
- }
-
- return true;
- }
-
- public function vote($verb_id, $choice) {
- $verb = Verb::findOrFail($verb_id);
- $user = Auth::user();
-
- if ($verb->active)
- return ['success' => false, 'message' => 'This verb has been accepted already.'];
-
- foreach ($verb->actions()->where('kind', VerbAction::KIND_VOTE)->get() as $vote) {
- if ($vote->user->id == $user->id) {
- $vote->delete();
- }
- }
-
- $vote = new VerbAction;
- $vote->user_id = $user->id;
- $vote->verb_id = $verb_id;
- $vote->kind = VerbAction::KIND_VOTE;
- $vote->vote_weight = ($choice == 1 ? 1 : -1) * $user->voteWeight();
- $vote->save();
-
- $accepted = $this->checkAccept($verb);
-
- return [
- 'success' => true,
- 'vote_weight' => $user->voteWeight(),
- 'accepted' => $accepted,
- 'new_vote_count' => $verb->voteCount()
- ];
- }
-
-}
diff --git a/app/RootKind.php b/app/Mode.php
index 6c68465..f7739fd 100644
--- a/app/RootKind.php
+++ b/app/Mode.php
@@ -1,7 +1,7 @@
<?php
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,10 +20,10 @@ namespace HebrewParseTrainer;
use Illuminate\Database\Eloquent\Model;
-class RootKind extends Model {
+class Mode extends Model {
- protected $table = 'root_kinds';
+ protected $table = 'modes';
public $timestamps = false;
- protected $fillable = ['strong', 'name'];
+ protected $fillable = ['name', 'abbreviation'];
}
diff --git a/app/PointChange.php b/app/PointChange.php
deleted file mode 100644
index c157b36..0000000
--- a/app/PointChange.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-namespace HebrewParseTrainer;
-
-use Illuminate\Database\Eloquent\Model;
-
-class PointChange extends Model {
-
- protected $table = 'point_changes';
- public $timestamps = false;
- protected $dates = ['date'];
- protected $fillable = ['kind', 'change'];
-
- const KIND_SUGGESTION_ACCEPTED = 1;
- const KIND_MANUAL = 3;
-
- const POINTS_SUGGESTION_ACCEPTED = 2;
-
-}
diff --git a/app/RandomLog.php b/app/RandomLog.php
index f0fefb9..8ba2889 100644
--- a/app/RandomLog.php
+++ b/app/RandomLog.php
@@ -1,7 +1,7 @@
<?php
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/app/RootTranslation.php b/app/RootTranslation.php
deleted file mode 100644
index 120dc5c..0000000
--- a/app/RootTranslation.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-namespace HebrewParseTrainer;
-
-use Illuminate\Database\Eloquent\Model;
-
-class RootTranslation extends Model {
-
- protected $table = 'root_translations';
- public $timestamps = false;
- protected $fillable = ['root', 'translation'];
-
-} \ No newline at end of file
diff --git a/app/Stem.php b/app/Stem.php
deleted file mode 100644
index 4616b1e..0000000
--- a/app/Stem.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-namespace HebrewParseTrainer;
-
-use Illuminate\Database\Eloquent\Model;
-
-class Stem extends Model {
-
- protected $table = 'stems';
- public $timestamps = false;
- protected $fillable = ['name'];
-
-} \ No newline at end of file
diff --git a/app/Tense.php b/app/Tense.php
index f30e352..b337eff 100644
--- a/app/Tense.php
+++ b/app/Tense.php
@@ -1,7 +1,7 @@
<?php
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/app/User.php b/app/User.php
deleted file mode 100644
index ca14b40..0000000
--- a/app/User.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-namespace HebrewParseTrainer;
-
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Facades\Hash;
-use Illuminate\Foundation\Auth\User as FoundationUser;
-
-class User extends FoundationUser {
-
- protected $table = 'users';
- public $timestamps = false;
- protected $fillable = ['email', 'name', 'password', 'isadmin'];
- protected $hidden = ['password', 'remember_token'];
-
- const VOTE_WEIGHT_BASE = 5;
-
- public function changePoints($kind, $change, $verb = null) {
- $change = new PointChange;
- $change->user = $this->id;
- $change->change = $change;
- $change->kind = $kind;
- $change->verb = is_null($verb) ? null : $verb->id;
- $change->save();
-
- $this->points += $change;
- $this->save();
- }
-
- public function voteWeight() {
- if ($this->isadmin)
- return Verb::ACCEPTED_VOTE_COUNT;
-
- if ($this->points <= 0)
- return 0;
-
- return floor(log($this->points, self::VOTE_WEIGHT_BASE));
- }
-
-}
diff --git a/app/Verb.php b/app/Verb.php
deleted file mode 100644
index 3ff79fc..0000000
--- a/app/Verb.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-namespace HebrewParseTrainer;
-
-use Illuminate\Database\Eloquent\Model;
-
-class Verb extends Model {
-
- protected $table = 'verbs';
- public $timestamps = false;
- protected $fillable = ['verb', 'root', 'stem', 'tense', 'person', 'gender', 'number'];
-
- const ACCEPTED_VOTE_COUNT = 5;
-
- public function actions() {
- return $this->hasMany('HebrewParseTrainer\VerbAction');
- }
-
- public function otherParsings() {
- return self::where('verb', $this->verb)->get()
- ->filter(function($v){return $v->verb === $this->verb;});
- }
-
- public function voteCount() {
- $votes = $this->actions()->where('kind', VerbAction::KIND_VOTE)->get();
- $total = 0;
- foreach ($votes as $vote)
- $total += $vote->vote_weight;
- return $total;
- }
-
- public function userVote(User $user) {
- $votes = $this->actions()
- ->where('kind', VerbAction::KIND_VOTE)
- ->where('user_id', $user->id)
- ->get();
- foreach ($votes as $vote) {
- return $vote->vote_weight;
- }
- return 0;
- }
-
- public function suggestedBy() {
- $suggs = $this->actions()
- ->where('kind', VerbAction::KIND_SUGGEST)
- ->get();
-
- foreach ($suggs as $sugg) {
- return $sugg->user;
- }
-
- return null;
- }
-
-}
diff --git a/app/VerbAction.php b/app/VerbAction.php
deleted file mode 100644
index 79c8cd0..0000000
--- a/app/VerbAction.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-namespace HebrewParseTrainer;
-
-use Illuminate\Database\Eloquent\Model;
-
-class VerbAction extends Model {
-
- protected $table = 'verb_actions';
- public $timestamps = false;
- protected $dates = ['date'];
- protected $fillable = ['user_id', 'verb_id', 'kind', 'vote_weight', 'comment_text'];
-
- const KIND_SUGGEST = 1;
- const KIND_VOTE = 2;
-
- public function verb() {
- return $this->belongsTo('HebrewParseTrainer\Verb');
- }
-
- public function user() {
- return $this->belongsTo('HebrewParseTrainer\User');
- }
-
-}
diff --git a/composer.json b/composer.json
index 7f8200c..ae6f198 100644
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
{
- "name": "hebrewtools/parsetrainer",
- "description": "A simple app to practice Hebrew verbs",
- "keywords": ["hebrew", "education", "bible"],
+ "name": "camilstaps/luo-parsetrainer",
+ "description": "A simple app to practice Ancient Greek verb forms",
+ "keywords": ["greek", "education"],
"license": "GPLv3",
"type": "project",
"require": {
diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php
deleted file mode 100644
index e0dc869..0000000
--- a/database/factories/ModelFactory.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-/*
-|--------------------------------------------------------------------------
-| Model Factories
-|--------------------------------------------------------------------------
-|
-| Here you may define all of your model factories. Model factories give
-| you a convenient way to create models for testing and seeding your
-| database. Just tell the factory how a default model should look.
-|
-*/
-
-$factory->define(App\User::class, function (Faker\Generator $faker) {
- static $password;
-
- return [
- 'name' => $faker->name,
- 'email' => $faker->unique()->safeEmail,
- 'password' => $password ?: $password = bcrypt('secret'),
- 'remember_token' => str_random(10),
- ];
-});
diff --git a/database/migrations/2016_01_04_143639_create_stems_table.php b/database/migrations/2016_01_04_143639_create_modes_table.php
index 539aa26..5bb1061 100644
--- a/database/migrations/2016_01_04_143639_create_stems_table.php
+++ b/database/migrations/2016_01_04_143639_create_modes_table.php
@@ -1,7 +1,7 @@
<?php
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
-class CreateStemsTable extends Migration
+class CreateModesTable extends Migration
{
/**
* Run the migrations.
@@ -29,9 +29,10 @@ class CreateStemsTable extends Migration
*/
public function up()
{
- Schema::create('stems', function (Blueprint $table) {
+ Schema::create('modes', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 24)->unique();
+ $table->string('abbreviation', 6)->unique();
});
}
@@ -42,6 +43,6 @@ class CreateStemsTable extends Migration
*/
public function down()
{
- Schema::drop('stems');
+ Schema::drop('modes');
}
}
diff --git a/database/migrations/2016_01_04_143647_create_tenses_table.php b/database/migrations/2016_01_04_143647_create_tenses_table.php
index 45c361a..9499c43 100644
--- a/database/migrations/2016_01_04_143647_create_tenses_table.php
+++ b/database/migrations/2016_01_04_143647_create_tenses_table.php
@@ -1,7 +1,7 @@
<?php
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/database/migrations/2016_01_04_143655_create_roots_table.php b/database/migrations/2016_01_04_143655_create_roots_table.php
deleted file mode 100644
index 0e6d858..0000000
--- a/database/migrations/2016_01_04_143655_create_roots_table.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreateRootsTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('roots', function (Blueprint $table) {
- $table->increments('id');
- $table->string('root', 24)->collate('utf8_general_ci')->unique();
- $table->boolean('strong');
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('roots');
- }
-}
diff --git a/database/migrations/2016_01_04_143702_create_verbs_table.php b/database/migrations/2016_01_04_143702_create_forms_table.php
index a50c365..4581db7 100644
--- a/database/migrations/2016_01_04_143702_create_verbs_table.php
+++ b/database/migrations/2016_01_04_143702_create_forms_table.php
@@ -1,7 +1,7 @@
<?php
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
-class CreateVerbsTable extends Migration
+class CreateFormsTable extends Migration
{
/**
* Run the migrations.
@@ -29,21 +29,21 @@ class CreateVerbsTable extends Migration
*/
public function up()
{
- Schema::create('verbs', function (Blueprint $table) {
+ Schema::create('forms', function (Blueprint $table) {
$table->increments('id');
- $table->string('verb', 24)->collate('utf8_general_ci');
- $table->string('root', 24)->collate('utf8_general_ci');
- $table->string('stem', 24);
+ $table->string('form', 24)->collate('utf8_general_ci');
$table->string('tense', 24);
+ $table->string('mode', 24);
+ $table->enum('voice', ['A','M','P','MP'])->nullable();
$table->enum('person', [1,2,3])->nullable();
- $table->enum('gender', ['m', 'f'])->nullable();
- $table->enum('number', ['s', 'p'])->nullable();
+ $table->enum('number', ['sg', 'pl'])->nullable();
+ $table->enum('gender', ['M', 'F', 'N'])->nullable();
+ $table->enum('case', ['nom', 'gen', 'dat', 'acc'])->nullable();
- $table->unique(['verb', 'root', 'stem', 'tense', 'person', 'gender', 'number']);
+ $table->unique(['form', 'tense', 'mode', 'voice', 'person', 'number', 'gender', 'case']);
- $table->foreign('root')->references('root')->on('roots');
- $table->foreign('stem')->references('name')->on('stems');
$table->foreign('tense')->references('name')->on('tenses');
+ $table->foreign('mode')->references('name')->on('modes');
});
}
@@ -54,6 +54,6 @@ class CreateVerbsTable extends Migration
*/
public function down()
{
- Schema::drop('verbs');
+ Schema::drop('forms');
}
}
diff --git a/database/migrations/2016_01_04_144049_create_root_translations_table.php b/database/migrations/2016_01_04_144049_create_root_translations_table.php
deleted file mode 100644
index 7c060ca..0000000
--- a/database/migrations/2016_01_04_144049_create_root_translations_table.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreateRootTranslationsTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('root_translations', function (Blueprint $table) {
- $table->increments('id');
- $table->string('root', 24)->collate('utf8_general_ci');
- $table->string('translation', 63);
-
- $table->unique(['root', 'translation']);
-
- $table->foreign('root')->references('root')->on('roots');
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('root_translations');
- }
-}
diff --git a/database/migrations/2016_05_10_211558_create_random_logs_table.php b/database/migrations/2016_05_10_211558_create_random_logs_table.php
index 10a924e..dc7ea0d 100644
--- a/database/migrations/2016_05_10_211558_create_random_logs_table.php
+++ b/database/migrations/2016_05_10_211558_create_random_logs_table.php
@@ -18,7 +18,7 @@ class CreateRandomLogsTable extends Migration
$table->integer('response')->unsigned();
$table->timestamp('created_at');
- $table->foreign('response')->references('id')->on('verbs');
+ $table->foreign('response')->references('id')->on('forms');
});
}
diff --git a/database/migrations/2016_09_04_081740_create_users_table.php b/database/migrations/2016_09_04_081740_create_users_table.php
deleted file mode 100644
index c5586dc..0000000
--- a/database/migrations/2016_09_04_081740_create_users_table.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreateUsersTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('users', function (Blueprint $table) {
- $table->increments('id');
- $table->string('email')->unique();
- $table->string('name')->unique();
- $table->string('password');
- $table->integer('points')->default(0);
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('users');
- }
-}
diff --git a/database/migrations/2016_09_04_081754_create_verb_actions_table.php b/database/migrations/2016_09_04_081754_create_verb_actions_table.php
deleted file mode 100644
index d7b0f29..0000000
--- a/database/migrations/2016_09_04_081754_create_verb_actions_table.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreateVerbActionsTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('verb_actions', function (Blueprint $table) {
- $table->increments('id');
- $table->integer('user_id')->unsigned();
- $table->integer('verb_id')->unsigned();
- $table->tinyInteger('kind');
- $table->tinyInteger('vote_weight')->nullable();
- $table->string('comment_text')->nullable();
- $table->timestamp('date')->default(DB::raw('CURRENT_TIMESTAMP'));
-
- $table->foreign('user_id')->references('id')->on('users');
- $table->foreign('verb_id')->references('id')->on('verbs');
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('verb_actions');
- }
-}
diff --git a/database/migrations/2016_09_04_081811_create_point_changes_table.php b/database/migrations/2016_09_04_081811_create_point_changes_table.php
deleted file mode 100644
index 4ade816..0000000
--- a/database/migrations/2016_09_04_081811_create_point_changes_table.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreatePointChangesTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('point_changes', function (Blueprint $table) {
- $table->increments('id');
- $table->integer('user_id')->unsigned();
- $table->integer('verb_id')->unsigned()->nullable();
- $table->tinyInteger('kind')->unsigned();
- $table->integer('change');
- $table->timestamp('date')->default(DB::raw('CURRENT_TIMESTAMP'));
-
- $table->foreign('user_id')->references('id')->on('users');
- $table->foreign('verb_id')->references('id')->on('verbs');
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('point_changes');
- }
-}
diff --git a/database/migrations/2016_09_04_081924_add_active_to_verbs.php b/database/migrations/2016_09_04_081924_add_active_to_verbs.php
deleted file mode 100644
index 79c5993..0000000
--- a/database/migrations/2016_09_04_081924_add_active_to_verbs.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class AddActiveToVerbs extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::table('verbs', function (Blueprint $table) {
- $table->boolean('active')->default(true);
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::table('verbs', function (Blueprint $table) {
- $table->dropColumn('active');
- });
- }
-}
diff --git a/database/migrations/2016_09_05_215803_create_root_kinds.php b/database/migrations/2016_09_05_215803_create_root_kinds.php
deleted file mode 100644
index 2ab1a42..0000000
--- a/database/migrations/2016_09_05_215803_create_root_kinds.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreateRootKinds extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('root_kinds', function (Blueprint $table) {
- $table->increments('id');
- $table->boolean('strong');
- $table->string('name')->unique();
- });
-
- Schema::table('roots', function (Blueprint $table) {
- $table->dropColumn('strong');
-
- $table->integer('root_kind_id')->unsigned()->nullable();
- $table->foreign('root_kind_id')->references('id')->on('root_kinds');
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::table('roots', function (Blueprint $table) {
- $table->dropForeign(['root_kind_id']);
- $table->dropColumn('root_kind_id');
-
- $table->boolean('strong')->default(1);
- });
-
- Schema::drop('root_kinds');
- }
-}
diff --git a/database/migrations/2016_09_05_230150_add_isadmin_to_users.php b/database/migrations/2016_09_05_230150_add_isadmin_to_users.php
deleted file mode 100644
index e548420..0000000
--- a/database/migrations/2016_09_05_230150_add_isadmin_to_users.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class AddIsadminToUsers extends Migration {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up() {
- Schema::table('users', function (Blueprint $table) {
- $table->boolean('isadmin')->default(false);
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down() {
- Schema::table('users', function (Blueprint $table) {
- $table->dropColumn('isadmin');
- });
- }
-}
diff --git a/database/migrations/2016_09_25_210947_add_remember_token.php b/database/migrations/2016_09_25_210947_add_remember_token.php
deleted file mode 100644
index 83f72bd..0000000
--- a/database/migrations/2016_09_25_210947_add_remember_token.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class AddRememberToken extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::table('users', function (Blueprint $table) {
- $table->rememberToken();
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::table('users', function (Blueprint $table) {
- $table->dropColumn('remember_token');
- });
- }
-}
diff --git a/database/migrations/2016_09_25_230620_create_password_resets_table.php b/database/migrations/2016_09_25_230620_create_password_resets_table.php
deleted file mode 100644
index bda733d..0000000
--- a/database/migrations/2016_09_25_230620_create_password_resets_table.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreatePasswordResetsTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('password_resets', function (Blueprint $table) {
- $table->string('email')->index();
- $table->string('token')->index();
- $table->timestamp('created_at')->nullable();
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('password_resets');
- }
-}
diff --git a/database/seeds/BasisTableSeeder.php b/database/seeds/BasisTableSeeder.php
index d02dfe8..3f933b0 100644
--- a/database/seeds/BasisTableSeeder.php
+++ b/database/seeds/BasisTableSeeder.php
@@ -1,7 +1,7 @@
<?php
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
use Illuminate\Database\Seeder;
use HebrewParseTrainer\RootKind;
-use HebrewParseTrainer\Stem;
+use HebrewParseTrainer\Mode;
use HebrewParseTrainer\Tense;
class BasisTableSeeder extends Seeder {
@@ -32,35 +32,19 @@ class BasisTableSeeder extends Seeder {
*/
public function run()
{
- Stem::create(['name' => 'Qal']);
- Stem::create(['name' => 'Niphal']);
- Stem::create(['name' => 'Piel']);
- Stem::create(['name' => 'Pual']);
- Stem::create(['name' => 'Hiphil']);
- Stem::create(['name' => 'Hophal']);
- Stem::create(['name' => 'Hitpael']);
+ Tense::create(['name' => 'praesens', 'abbreviation' => 'pr']);
+ Tense::create(['name' => 'imperfectum', 'abbreviation' => 'impf']);
+ Tense::create(['name' => 'aoristus', 'abbreviation' => 'aor']);
+ Tense::create(['name' => 'futurum', 'abbreviation' => 'fut']);
+ Tense::create(['name' => 'perfectum', 'abbreviation' => 'pf']);
+ Tense::create(['name' => 'plusquamperfectum', 'abbreviation' => 'pqpf']);
- Tense::create(['name' => 'perfect', 'abbreviation' => 'pf']);
- Tense::create(['name' => 'imperfect', 'abbreviation' => 'ipf']);
- Tense::create(['name' => 'cohortative', 'abbreviation' => 'coh']);
- Tense::create(['name' => 'imperative', 'abbreviation' => 'imp']);
- Tense::create(['name' => 'jussive', 'abbreviation' => 'ius']);
- Tense::create(['name' => 'infinitive construct', 'abbreviation' => 'infcs']);
- Tense::create(['name' => 'infinitive absolute', 'abbreviation' => 'infabs']);
- Tense::create(['name' => 'participle active', 'abbreviation' => 'pta']);
- Tense::create(['name' => 'participle passive', 'abbreviation' => 'ptp']);
-
- RootKind::create(['strong' => true, 'name' => 'Strong']);
- RootKind::create(['strong' => false, 'name' => 'I-Guttural']);
- RootKind::create(['strong' => false, 'name' => 'I-Aleph']);
- RootKind::create(['strong' => false, 'name' => 'I-Nun']);
- RootKind::create(['strong' => false, 'name' => 'I-Waw']);
- RootKind::create(['strong' => false, 'name' => 'I-Yod']);
- RootKind::create(['strong' => false, 'name' => 'II-Guttural']);
- RootKind::create(['strong' => false, 'name' => 'III-He']);
- RootKind::create(['strong' => false, 'name' => 'Biconsonantal']);
- RootKind::create(['strong' => false, 'name' => 'Geminate']);
- RootKind::create(['strong' => false, 'name' => 'Double weak']);
+ Mode::create(['name' => 'indicativus', 'abbreviation' => 'ind']);
+ Mode::create(['name' => 'conjunctivus', 'abbreviation' => 'conj']);
+ Mode::create(['name' => 'optativus', 'abbreviation' => 'opt']);
+ Mode::create(['name' => 'imperativus', 'abbreviation' => 'imp!']);
+ Mode::create(['name' => 'participium', 'abbreviation' => 'ptc']);
+ Mode::create(['name' => 'infinitivus', 'abbreviation' => 'inf']);
}
}
diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php
index 7cb8402..c5b6ab0 100644
--- a/database/seeds/DatabaseSeeder.php
+++ b/database/seeds/DatabaseSeeder.php
@@ -1,7 +1,7 @@
<?php
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,8 +32,7 @@ class DatabaseSeeder extends Seeder
Model::unguard();
$this->call('BasisTableSeeder');
- $this->call('RootTableSeeder');
- $this->call('VerbTableSeeder');
+ $this->call('FormTableSeeder');
Model::reguard();
}
diff --git a/app/Observers/UserObserver.php b/database/seeds/FormTableSeeder.php
index b5a2421..4ddb983 100644
--- a/app/Observers/UserObserver.php
+++ b/database/seeds/FormTableSeeder.php
@@ -1,7 +1,7 @@
<?php
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,20 +16,19 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-namespace App\Observers;
-use Illuminate\Support\Facades\Mail;
+use Illuminate\Database\Seeder;
+use HebrewParseTrainer\Form;
-use HebrewParseTrainer\User;
-
-class UserObserver {
-
- public function created(User $user) {
- Mail::plain('mails.user.create', ['user' => $user], function ($msg) use ($user) {
- $msg->subject('Your account');
- $msg->to([$user->email]);
- $msg->cc(['info@camilstaps.nl']);
- });
+class FormTableSeeder extends Seeder {
+ /**
+ * Run the database seeds.
+ *
+ * @return void
+ */
+ public function run()
+ {
+ Form::create(['form' => 'λύω', 'tense' => 'praesens', 'mode' => 'indicativus',
+ 'voice' => 'A', 'person' => '1', 'number' => 'sg']);
}
-
}
diff --git a/database/seeds/RootTableSeeder.php b/database/seeds/RootTableSeeder.php
deleted file mode 100644
index 7c3b0ea..0000000
--- a/database/seeds/RootTableSeeder.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-use Illuminate\Database\Seeder;
-use HebrewParseTrainer\Root;
-use HebrewParseTrainer\RootKind;
-use HebrewParseTrainer\RootTranslation;
-
-class RootTableSeeder extends Seeder {
-
- protected function add($root, $kind) {
- $kind_id = null;
- foreach (RootKind::where('name', $kind)->get() as $rootkind)
- $kind_id = $rootkind->id;
-
- if (is_null($kind_id))
- die('Unknown root kind ' . $kind . "\n");
-
- Root::create([
- 'root' => $root,
- 'root_kind_id' => $kind_id
- ]);
- }
-
- /**
- * Run the database seeds.
- *
- * @return void
- */
- public function run()
- {
- $this->add('קטל', 'Strong');
-
- RootTranslation::create(['root' => 'קטל', 'translation' => 'kill']);
- }
-
-}
diff --git a/database/seeds/VerbTableSeeder.php b/database/seeds/VerbTableSeeder.php
deleted file mode 100644
index 89a8094..0000000
--- a/database/seeds/VerbTableSeeder.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-use Illuminate\Database\Seeder;
-use HebrewParseTrainer\Verb;
-
-class VerbTableSeeder extends Seeder {
-
- /**
- * Run the database seeds.
- *
- * @return void
- */
- public function run()
- {
- Verb::create(['verb' => 'קָטַל', 'root' => 'קטל', 'stem' => 'Qal',
- 'tense' => 'perfect', 'person' => 3, 'gender' => 'm', 'number' => 's']);
- Verb::create(['verb' => 'קָֽטְלָה', 'root' => 'קטל', 'stem' => 'Qal',
- 'tense' => 'perfect', 'person' => 3, 'gender' => 'f', 'number' => 's']);
- Verb::create(['verb' => 'קָטַ֫לְתָּ', 'root' => 'קטל', 'stem' => 'Qal',
- 'tense' => 'perfect', 'person' => 2, 'gender' => 'm', 'number' => 's']);
- Verb::create(['verb' => 'קָטַלְתְּ', 'root' => 'קטל', 'stem' => 'Qal',
- 'tense' => 'perfect', 'person' => 2, 'gender' => 'f', 'number' => 's']);
- Verb::create(['verb' => 'קָטַ֫לְתִּי', 'root' => 'קטל', 'stem' => 'Qal',
- 'tense' => 'perfect', 'person' => 1, 'gender' => 'm', 'number' => 's']);
- Verb::create(['verb' => 'קָטַ֫לְתִּי', 'root' => 'קטל', 'stem' => 'Qal',
- 'tense' => 'perfect', 'person' => 1, 'gender' => 'f', 'number' => 's']);
-
- Verb::create(['verb' => 'קָֽטְלוּ', 'root' => 'קטל', 'stem' => 'Qal',
- 'tense' => 'perfect', 'person' => 3, 'gender' => 'm', 'number' => 'p']);
- Verb::create(['verb' => 'קָֽטְלוּ', 'root' => 'קטל', 'stem' => 'Qal',
- 'tense' => 'perfect', 'person' => 3, 'gender' => 'f', 'number' => 'p']);
- Verb::create(['verb' => 'קְטַלְתֶּם', 'root' => 'קטל', 'stem' => 'Qal',
- 'tense' => 'perfect', 'person' => 2, 'gender' => 'm', 'number' => 'p']);
- Verb::create(['verb' => 'קְטַלְתֶּן', 'root' => 'קטל', 'stem' => 'Qal',
- 'tense' => 'perfect', 'person' => 2, 'gender' => 'f', 'number' => 'p']);
- Verb::create(['verb' => 'קָטַ֫לְנוּ', 'root' => 'קטל', 'stem' => 'Qal',
- 'tense' => 'perfect', 'person' => 1, 'gender' => 'm', 'number' => 'p']);
- Verb::create(['verb' => 'קָטַ֫לְנוּ', 'root' => 'קטל', 'stem' => 'Qal',
- 'tense' => 'perfect', 'person' => 1, 'gender' => 'f', 'number' => 'p']);
- }
-
-} \ No newline at end of file
diff --git a/public/css/fonts/EzraSIL.ttf b/public/css/fonts/EzraSIL.ttf
deleted file mode 100644
index b135760..0000000
--- a/public/css/fonts/EzraSIL.ttf
+++ /dev/null
Binary files differ
diff --git a/public/css/fonts/SBL_grk.ttf b/public/css/fonts/SBL_grk.ttf
new file mode 100644
index 0000000..90a807b
--- /dev/null
+++ b/public/css/fonts/SBL_grk.ttf
Binary files differ
diff --git a/public/css/hebrewparsetrainer.css b/public/css/luoparsetrainer.css
index 03c661c..e3af912 100644
--- a/public/css/hebrewparsetrainer.css
+++ b/public/css/luoparsetrainer.css
@@ -1,6 +1,6 @@
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@font-face {
- font-family: 'Ezra SIL';
- src: url('fonts/EzraSIL.ttf');
+ font-family: 'SBL Greek';
+ src: url('fonts/SBL_grk.ttf');
}
body {
@@ -59,19 +59,19 @@ body {
margin-bottom: 20px;
}
-#trainer-input-help {
- display: none;
+#trainer-input-fancy button {
+ margin-bottom: 3px;
+ min-width: 7em;
}
-.hebrew {
- direction: rtl;
- font-family: 'Ezra SIL', David;
+#trainer-input-help {
+ display: none;
}
-.ltr {
- direction: ltr;
+.greek {
+ font-family: 'SBL Greek', 'Palatino Linotype';
}
-.hebrew-large {
+.greek-large {
font-size: 40px;
}
diff --git a/public/js/alerts.js b/public/js/alerts.js
deleted file mode 100644
index c1763ed..0000000
--- a/public/js/alerts.js
+++ /dev/null
@@ -1,11 +0,0 @@
-$.fn.addAlert = function (kind, message) {
- var box = '<div class="alert alert-' + kind + ' alert-dismissible" role="alert">' +
- '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>' +
- message + '</div>';
-
- $(this).find('.alerts').append($(box));
-}
-
-$.fn.clearAlerts = function () {
- $(this).find('.alerts').html('');
-}
diff --git a/public/js/hebrewparsetrainer.js b/public/js/luoparsetrainer.js
index d875a90..11394e4 100644
--- a/public/js/hebrewparsetrainer.js
+++ b/public/js/luoparsetrainer.js
@@ -1,6 +1,6 @@
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,38 +36,78 @@ $(document).ready(function(){
var input_count = 0;
var checked = false;
- function stepFancyInput(step) {
+ function stepFancyInput(step, val) {
$('#trainer-input-fancy').html('');
var buts = {};
switch (step) {
case 0:
- buts = { 'Q ': 'Qal'
- , 'Hip ': 'Hiphil'
- , 'Ho ': 'Hophal'
- , 'Ni ': 'Niphal'
- , 'Pi ': 'Piel'
- , 'Pu ': 'Pual'
- , 'Hit ': 'Hitpael'
+ buts = { 'pr ': 'Praesens'
+ , 'impf ': 'Imperfectum'
+ , 'aor ': 'Aoristus'
+ , 'fut ': 'Futurum'
+ , 'pf ': 'Perfectum'
+ , 'pqpf ': 'Plusquamperfectum'
}; break;
case 1:
- buts = { 'pf ': 'Pf.'
- , 'ipf ': 'Ipf.'
- , 'coh ': 'Coh.'
- , 'imp ': 'Imp.'
- , 'ius ': 'Ius.'
- , 'infcs': 'Inf. cs.'
- , 'infabs': 'Inf. abs.'
- , 'pta ': 'Part. act.'
- , 'ptp ': 'Part. pass.'
+ buts = { 'ind ': 'Indicativus'
+ , 'conj ': 'Conjunctivus'
+ , 'opt ': 'Optativus'
+ , 'imp! ': 'Imperativus'
+ , 'ptc ': 'Participium'
+ , 'inf ': 'Infinitivus'
}; break;
case 2:
- buts = { '1': '1', '2': '2', '3': '3', '': 'N/A' }; break;
+ buts = { 'A ': 'Activum'
+ , 'M ': 'Medium'
+ , 'P ': 'Passivum'
+ , 'MP ': 'Medio-passivum'
+ }; break;
case 3:
- buts = { 'm': 'Masculine', 'f': 'Feminine', '': 'N/A' }; break;
- case 4:
- buts = { 's': 'Singular', 'p': 'Plural', '': 'N/A' }; break;
+ if (val.match(/ inf /)) {
+ /* no buttons */
+ } else if (val.match(/ ptc /)) {
+ buts = {
+ 'M nom ev': 'M nom ev',
+ 'F nom ev': 'F nom ev',
+ 'N nom ev': 'N nom ev',
+ 'M gen ev': 'M gen ev',
+ 'F gen ev': 'F gen ev',
+ 'N gen ev': 'N gen ev',
+ 'M dat ev': 'M dat ev',
+ 'F dat ev': 'F dat ev',
+ 'N dat ev': 'N dat ev',
+ 'M acc ev': 'M acc ev',
+ 'N acc ev': 'N acc ev',
+ 'F acc ev': 'F acc ev',
+ 'M nom mv': 'M nom mv',
+ 'F nom mv': 'F nom mv',
+ 'N nom mv': 'N nom mv',
+ 'M gen mv': 'M gen mv',
+ 'F gen mv': 'F gen mv',
+ 'N gen mv': 'N gen mv',
+ 'M dat mv': 'M dat mv',
+ 'F dat mv': 'F dat mv',
+ 'N dat mv': 'N dat mv',
+ 'M acc mv': 'M acc mv',
+ 'F acc mv': 'F acc mv',
+ 'N acc mv': 'N acc mv'
+ };
+ } else {
+ buts = {
+ '1 ev': '1 ev',
+ '2 ev': '2 ev',
+ '3 ev': '3 ev',
+ '1 mv': '1 mv',
+ '2 mv': '2 mv',
+ '3 mv': '3 mv',
+ };
+ }
+ break;
}
+ var input_field = $('#trainer-input-fancy');
+
+ var i = 0;
for (k in buts) {
var but = $('<button></button>');
but.addClass('btn btn-default').attr('role', 'button');
@@ -75,8 +115,8 @@ $(document).ready(function(){
but.click(function(){
var ip = $('#trainer-input-'+input_count);
ip.val(ip.val() + $(this).val()).focus();
- if (step < 4) {
- stepFancyInput(step + 1);
+ if (step < 3) {
+ stepFancyInput(step + 1, ip.val());
} else {
var done = checkInput(true);
if ($('#trainer-input-'+input_count).parent().hasClass('has-error')) {
@@ -93,7 +133,10 @@ $(document).ready(function(){
}
});
- $('#trainer-input-fancy').append(but).append('&nbsp;');
+ input_field.append(but).append('&nbsp;');
+
+ if (Object.keys(buts).length > 6 && !(++i % 3))
+ input_field.append($('<br>'));
}
}
@@ -103,7 +146,7 @@ $(document).ready(function(){
<div class='col-md-8'>\
<div class='form-group'>\
<label for='trainer-input-"+input_count+"'>Parse:</label>\
- <input type='text' class='form-control' id='trainer-input-"+input_count+"' placeholder='Q pf 3ms' spellcheck='false'/>\
+ <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'>\
@@ -150,34 +193,33 @@ $(document).ready(function(){
$('#trainer-answer').text('');
removeInputs();
- var stems = $('input[name="stem"]:checked').map(function(){return this.value;});
+ var modes = $('input[name="mode"]:checked').map(function(){return this.value;});
var tenses = $('input[name="tense"]:checked').map(function(){return this.value;});
- var roots = $('select[name="root"]').val();
- $.ajax('verb/random/', {
+ $.ajax('form/random/', {
method: 'POST',
data: {
_token: $('#csrf').val(),
- stem: $.makeArray(stems).join(),
- tense: $.makeArray(tenses).join(),
- root: $.makeArray(roots).join()
+ mode: $.makeArray(modes).join(),
+ tense: $.makeArray(tenses).join()
},
dataType: 'json',
error: function(jqxhr, status, error) {
$('#trainer-404').fadeIn();
},
success: function(data, status, jqxhr) {
- $('#trainer-verb').text(data.verb.verb).css({color: 'black'});
+ $('#trainer-verb').text(data.form.form).css({color: 'black'});
correct_answers = [];
for (var i in data.answers) {
var answer = {
- root: data.answers[i].root,
- stem: data.answers[i].stem,
tense: data.answers[i].tense,
+ mode: data.answers[i].mode,
+ voice: data.answers[i].voice,
person: data.answers[i].person,
gender: data.answers[i].gender,
- number: data.answers[i].number
+ number: data.answers[i].number,
+ case_: data.answers[i]['case']
};
correct_answers.push(answer);
}
@@ -187,88 +229,123 @@ $(document).ready(function(){
});
}
- var stems = [];
+ var modes = [];
var tenses = [];
var tenses_abbr = [];
- function findStem(stem) {
- var stems_ = stems.filter(function(s){return s.toLowerCase().indexOf(stem.toLowerCase()) == 0;});
- if (stems_.length == 1)
- return stems_[0];
+ function findTense(tense) {
+ switch (tense) {
+ case 'pr': return 'praesens';
+ case 'impf': return 'imperfectum';
+ case 'aor': return 'aoristus';
+ case 'fut': return 'futurum';
+ case 'pf': return 'perfectum';
+ case 'pqpf': return 'plusquamperfectum';
+ default: return undefined;
+ }
}
- function findTense(tense) {
- if (tenses.indexOf(tense) != -1)
- return tense;
- if (tenses_abbr.indexOf(tense) != -1)
- return tenses[tenses_abbr.indexOf(tense)];
+ function findMode(mode) {
+ switch (mode) {
+ case 'ind': return 'indicativus';
+ case 'conj': return 'conjunctivus';
+ case 'opt': return 'optativus';
+ case 'imp!': return 'imperativus';
+ default: return undefined;
+ }
}
function parseAnswer(parsing) {
- var persons = ['1', '2', '3', null];
- var genders = ['m', 'f', 'c', null];
- var numbers = ['s', 'p', null];
+ 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*$/);
+ if (match) {
+ var tense = findTense(match[1]);
+ var mode = findMode(match[2]);
- var re = /^\s*(\w+)\s+(\w+)(?:\s+(?:([123])\s*)?([mf])\s*([sp])\s*)?$/;
- var match = parsing.match(re);
- if (match == null)
- return false;
+ if (typeof tense=='undefined' || typeof mode=='undefined')
+ return false;
- var stem = findStem(match[1]);
- var tense = findTense(match[2]);
- var person = match[3] ? match[3] : null;
- var gender = match[4] ? match[4] : null;
- var number = match[5] ? match[5] : null;
+ return {
+ tense: tense,
+ mode: mode,
+ voice: match[3],
+ person: match[4],
+ gender: null,
+ number: match[5] == 'ev' ? 'sg' : 'pl',
+ case_: null
+ };
+ }
- if (typeof stem === 'undefined' || typeof tense === 'undefined' || $.inArray(person, persons) == -1 ||
- $.inArray(gender, genders) == -1 || $.inArray(number, numbers) == -1)
- return false;
+ 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*$/);
+ if (match) {
+ var tense = findTense(match[1]);
- if (tense.indexOf('infinitive') == 0 && (person != null || gender != null || number != null))
- return false;
- if (tense.indexOf('infinitive') != 0) {
- if (gender == null || number == null)
- return false;
- if (tense.indexOf('participle') == 0 && person != null)
+ if (typeof tense=='undefined')
return false;
- if (tense.indexOf('participle') != 0 && person == null)
+
+ return {
+ tense: tense,
+ mode: 'participium',
+ voice: match[2],
+ person: null,
+ gender: match[3],
+ number: match[5] == 'ev' ? 'sg' : 'pl',
+ case_: match[4]
+ };
+ }
+
+ match = parsing.match(/^\s*(pr|impf|aor|fut|pf|pqpf)\s+inf\s+(A|M|P|MP)\s*$/);
+ if (match) {
+ var tense = findTense(match[1]);
+
+ if (typeof tense=='undefined')
return false;
+
+ return {
+ tense: tense,
+ mode: 'infinitivus',
+ voice: match[2],
+ person: null,
+ gender: null,
+ number: null,
+ case_: null
+ };
}
- return {
- stem: stem,
- tense: tense,
- person: person,
- gender: gender,
- number: number
- };
+ return false;
}
- function parsingToString(parsing, extended) {
- var genders = {
- 'm': 'masculine',
- 'f': 'feminine'
- };
- var numbers = {
- 's': 'singular',
- 'p': 'plural'
- };
-
- var prs = parsing.stem + ' ' + parsing.tense +
- (parsing.person ? (' ' + parsing.person) : '');
-
- if (extended === true) {
- prs += (parsing.gender ? (' ' + genders[parsing.gender]) : '') +
- (parsing.number ? (' ' + numbers[parsing.number]) : '');
- } else {
- prs += (parsing.gender ? (' ' + parsing.gender) : '') +
- (parsing.number ? (' ' + parsing.number) : '');
+ function abbreviate(term) {
+ switch (term) {
+ case 'praesens': return 'pr';
+ case 'imperfectum': return 'impf';
+ case 'aoristus': return 'aor';
+ case 'futurum': return 'fut';
+ case 'perfectum': return 'pf';
+ case 'plusquamperfectum': return 'pqpf';
+ case 'indicativus': return 'ind';
+ case 'conjunctivus': return 'conj';
+ case 'optativus': return 'opt';
+ case 'imperativus': return 'imp!';
+ case 'participium': return 'ptc';
+ case 'infinitivus': return 'inf';
+ default: return term;
}
+ }
- if ('root' in parsing)
- prs += ' ' + parsing.root;
-
- return prs;
+ function parsingToString(parsing, abbr) {
+ var tense = abbr === true ? abbreviate(parsing.tense) : parsing.tense;
+ var mode = abbr === true ? abbreviate(parsing.mode) : parsing.mode;
+ var number = parsing.number == 'sg' ? 'ev' : 'mv';
+ var tense_mode_voice = [tense, mode, parsing.voice].join(' ');
+
+ switch (parsing.mode) {
+ case 'infinitivus':
+ return tense_mode_voice;
+ case 'participium':
+ return [tense_mode_voice, parsing.gender, parsing.case_, number].join(' ');
+ default:
+ return [tense_mode_voice, parsing.person, number].join(' ');
+ }
}
function processInput() {
@@ -277,7 +354,7 @@ $(document).ready(function(){
if (answer === false) {
input.parent().addClass('has-error');
$('#trainer-parsed-' + input_count).val(
- input.val().length < 8 ? 'Input full parsing...' : 'Parsing error');
+ 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));
@@ -294,10 +371,7 @@ $(document).ready(function(){
for (var i in correct_answers) {
var correct_answer = correct_answers[i];
- var root = correct_answer['root'];
- delete correct_answer['root'];
var json = JSON.stringify(correct_answer);
- correct_answer['root'] = root;
if (JSON.stringify(answer) == json) {
$('#trainer-input-'+input_count)
.css({backgroundColor: '#dff0d8'})
@@ -327,10 +401,10 @@ $(document).ready(function(){
}
function init() {
- $.ajax('stem/', {
+ $.ajax('mode/', {
dataType: 'json',
success: function(data, status, jqxhr) {
- stems = data.map(function(d){return d.name;});
+ modes = data.map(function(d){return d.name;});
}
});
@@ -346,7 +420,7 @@ $(document).ready(function(){
reloadVerb();
}
- $('#hebrewparsetrainer-settings .reload-verb').change(function(){
+ $('#luoparsetrainer-settings .reload-verb').change(function(){
reloadVerb();
});
diff --git a/public/js/moderators.js b/public/js/moderators.js
deleted file mode 100644
index 36ec3ed..0000000
--- a/public/js/moderators.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-$(document).ready(function(){
- $('.vote').click(function(){
- var vote = parseInt($(this).data('vote'));
- var verbId = $(this).data('verb');
-
- var container = $(this).closest('tr');
-
- var fail = function(msg) {
- alert('Voting failed with the message: "' + msg + '". Please try again.');
- }
-
- $.ajax({
- url: app_url + 'verb/' + verbId + '/vote/' + vote,
- error: function(jqxhr, stat, error) {
- fail(stat);
- },
- success: function(data) {
- if (!data.success) {
- fail(data.message);
- return;
- }
-
- var btns = container.find('.vote');
- if (vote) {
- $(btns[0]).removeClass('btn-danger');
- $(btns[0]).addClass('btn-default');
- $(btns[1]).addClass('btn-success');
- $(btns[1]).removeClass('btn-default');
- } else {
- $(btns[0]).addClass('btn-danger');
- $(btns[0]).removeClass('btn-default');
- $(btns[1]).removeClass('btn-success');
- $(btns[1]).addClass('btn-default');
- }
-
- container.find('.vote-count').text(data.new_vote_count);
-
- if (data.accepted) {
- alert('This verb has now been accepted!');
- container.remove();
- }
- }
- });
-
- return true;
- });
-
- $('form#suggest').submit(function(){
- var form = $(this);
-
- form.clearAlerts();
-
- $.ajax({
- url: app_url + 'verb/suggest',
- method: 'post',
- data: form.serialize(),
- error: function(jqxhr, stat, error) {
- form.addAlert('danger', stat);
- },
- success: function(data) {
- if (!data.success) {
- form.addAlert('danger', data.message);
- return;
- }
-
- if (data.accepted) {
- form.addAlert('success', 'The new verb has been <b>accepted immediately</b>.');
- } else {
- form.addAlert('success', 'The new verb has been proposed for peer review.');
- }
- }
- });
-
- return false;
- });
-
- $('form#add-root').submit(function(){
- var form = $(this);
-
- form.clearAlerts();
-
- $.ajax({
- url: app_url + 'root/create',
- method: 'post',
- data: form.serialize(),
- error: function(jqxhr, stat, error) {
- form.addAlert('danger', stat);
- },
- success: function(data) {
- if (!data.success) {
- form.addAlert('danger', data.message);
- return;
- }
-
- window.location = window.location;
- }
- });
-
- return false;
- });
-});
diff --git a/resources/views/add_root.blade.php b/resources/views/add_root.blade.php
deleted file mode 100644
index 107eb16..0000000
--- a/resources/views/add_root.blade.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-use HebrewParseTrainer\RootKind;
-?>
-<div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">Add a new root</h3>
- </div>
- <div class="panel-body">
- <form id="add-root">
- <input type="hidden" name="_token" value="{{ csrf_token() }}">
- <div class="alerts"></div>
- <div class="form-group">
- <label for="add-root-root">Root</label>
- <input type="text" class="form-control hebrew input-lg" id="add-root-root" name="root" placeholder="קטל"/>
- </div>
- <div class="form-group">
- <label for="add-root-kind">Kind</label>
- <select id="add-root-kind" class="form-control" name="root_kind_id">
- @foreach(RootKind::all() as $kind)
- <option value="{{ $kind->id }}">{{{ $kind->name }}}</option>
- @endforeach
- </select>
- </div>
- <div class="form-group">
- <button type="submit" class="btn btn-primary">Add</button>
- </div>
- </form>
- </div>
-</div>
diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php
deleted file mode 100644
index 2070f2b..0000000
--- a/resources/views/auth/login.blade.php
+++ /dev/null
@@ -1,68 +0,0 @@
-@extends('layouts.master')
-
-@section('master-content')
-<div class="container">
- <div class="row">
- <div class="col-md-8 col-md-offset-2">
- <div class="panel panel-default">
- <div class="panel-heading">Login</div>
- <div class="panel-body">
- <form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}">
- {{ csrf_field() }}
-
- <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
- <label for="email" class="col-md-4 control-label">E-Mail Address</label>
-
- <div class="col-md-6">
- <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
-
- @if ($errors->has('email'))
- <span class="help-block">
- <strong>{{ $errors->first('email') }}</strong>
- </span>
- @endif
- </div>
- </div>
-
- <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
- <label for="password" class="col-md-4 control-label">Password</label>
-
- <div class="col-md-6">
- <input id="password" type="password" class="form-control" name="password" required>
-
- @if ($errors->has('password'))
- <span class="help-block">
- <strong>{{ $errors->first('password') }}</strong>
- </span>
- @endif
- </div>
- </div>
-
- <div class="form-group">
- <div class="col-md-6 col-md-offset-4">
- <div class="checkbox">
- <label>
- <input type="checkbox" name="remember"> Remember Me
- </label>
- </div>
- </div>
- </div>
-
- <div class="form-group">
- <div class="col-md-8 col-md-offset-4">
- <button type="submit" class="btn btn-primary">
- Login
- </button>
-
- <a class="btn btn-link" href="{{ url('/password/reset') }}">
- Forgot Your Password?
- </a>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
-</div>
-@endsection
diff --git a/resources/views/auth/passwords/email.blade.php b/resources/views/auth/passwords/email.blade.php
deleted file mode 100644
index 62e0120..0000000
--- a/resources/views/auth/passwords/email.blade.php
+++ /dev/null
@@ -1,47 +0,0 @@
-@extends('layouts.master')
-
-<!-- Main Content -->
-@section('master-content')
-<div class="container">
- <div class="row">
- <div class="col-md-8 col-md-offset-2">
- <div class="panel panel-default">
- <div class="panel-heading">Reset Password</div>
- <div class="panel-body">
- @if (session('status'))
- <div class="alert alert-success">
- {{ session('status') }}
- </div>
- @endif
-
- <form class="form-horizontal" role="form" method="POST" action="{{ url('/password/email') }}">
- {{ csrf_field() }}
-
- <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
- <label for="email" class="col-md-4 control-label">E-Mail Address</label>
-
- <div class="col-md-6">
- <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required>
-
- @if ($errors->has('email'))
- <span class="help-block">
- <strong>{{ $errors->first('email') }}</strong>
- </span>
- @endif
- </div>
- </div>
-
- <div class="form-group">
- <div class="col-md-6 col-md-offset-4">
- <button type="submit" class="btn btn-primary">
- Send Password Reset Link
- </button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
-</div>
-@endsection
diff --git a/resources/views/auth/passwords/reset.blade.php b/resources/views/auth/passwords/reset.blade.php
deleted file mode 100644
index deb4d56..0000000
--- a/resources/views/auth/passwords/reset.blade.php
+++ /dev/null
@@ -1,70 +0,0 @@
-@extends('layouts.master')
-
-@section('master-content')
-<div class="container">
- <div class="row">
- <div class="col-md-8 col-md-offset-2">
- <div class="panel panel-default">
- <div class="panel-heading">Reset Password</div>
-
- <div class="panel-body">
- <form class="form-horizontal" role="form" method="POST" action="{{ url('/password/reset') }}">
- {{ csrf_field() }}
-
- <input type="hidden" name="token" value="{{ $token }}">
-
- <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
- <label for="email" class="col-md-4 control-label">E-Mail Address</label>
-
- <div class="col-md-6">
- <input id="email" type="email" class="form-control" name="email" value="{{ $email or old('email') }}" required autofocus>
-
- @if ($errors->has('email'))
- <span class="help-block">
- <strong>{{ $errors->first('email') }}</strong>
- </span>
- @endif
- </div>
- </div>
-
- <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
- <label for="password" class="col-md-4 control-label">Password</label>
-
- <div class="col-md-6">
- <input id="password" type="password" class="form-control" name="password" required>
-
- @if ($errors->has('password'))
- <span class="help-block">
- <strong>{{ $errors->first('password') }}</strong>
- </span>
- @endif
- </div>
- </div>
-
- <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
- <label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
- <div class="col-md-6">
- <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
-
- @if ($errors->has('password_confirmation'))
- <span class="help-block">
- <strong>{{ $errors->first('password_confirmation') }}</strong>
- </span>
- @endif
- </div>
- </div>
-
- <div class="form-group">
- <div class="col-md-6 col-md-offset-4">
- <button type="submit" class="btn btn-primary">
- Reset Password
- </button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
-</div>
-@endsection
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php
deleted file mode 100644
index c4f9009..0000000
--- a/resources/views/auth/register.blade.php
+++ /dev/null
@@ -1,82 +0,0 @@
-@extends('layouts.master')
-
-@section('master-content')
-<div class="container">
- <div class="row">
- <div class="col-md-8 col-md-offset-2">
- <div class="panel panel-default">
- <div class="panel-heading">Register</div>
- <div class="panel-body">
- <form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}">
- {{ csrf_field() }}
-
- <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
- <label for="name" class="col-md-4 control-label">Name</label>
-
- <div class="col-md-6">
- <input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" required autofocus>
-
- @if ($errors->has('name'))
- <span class="help-block">
- <strong>{{ $errors->first('name') }}</strong>
- </span>
- @endif
- </div>
- </div>
-
- <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
- <label for="email" class="col-md-4 control-label">E-Mail Address</label>
-
- <div class="col-md-6">
- <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required>
-
- @if ($errors->has('email'))
- <span class="help-block">
- <strong>{{ $errors->first('email') }}</strong>
- </span>
- @endif
- </div>
- </div>
-
- <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
- <label for="password" class="col-md-4 control-label">Password</label>
-
- <div class="col-md-6">
- <input id="password" type="password" class="form-control" name="password" required>
-
- @if ($errors->has('password'))
- <span class="help-block">
- <strong>{{ $errors->first('password') }}</strong>
- </span>
- @endif
- </div>
- </div>
-
- <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
- <label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
-
- <div class="col-md-6">
- <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
-
- @if ($errors->has('password_confirmation'))
- <span class="help-block">
- <strong>{{ $errors->first('password_confirmation') }}</strong>
- </span>
- @endif
- </div>
- </div>
-
- <div class="form-group">
- <div class="col-md-6 col-md-offset-4">
- <button type="submit" class="btn btn-primary">
- Register
- </button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
-</div>
-@endsection
diff --git a/resources/views/contribute.blade.php b/resources/views/contribute.blade.php
deleted file mode 100644
index 86473de..0000000
--- a/resources/views/contribute.blade.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-use HebrewParseTrainer\Verb;
-?>
-@extends('layouts.master')
-
-@section('master-content')
-<p class="lead">
- Thank you for wanting to help out! To expand our database, we are looking for volunteers to enter more verbs.
-</p>
-
-@if(!Auth::check())
- <a class="btn btn-lg btn-primary" href="{{ url('/login') }}">Login</a>
- <a class="btn btn-lg btn-success" href="{{ url('/register') }}">Sign up</a>
-@endif
-
-<h3>Here's how it works:</h3>
-
-<ul>
- <li>Any user can <em>suggest new verbs</em>.</li>
- <li>These have to be <em>peer-reviewed</em> by other contributors.</li>
- <li>It has to get <em>{{ Verb::ACCEPTED_VOTE_COUNT }}</em> votes to be accepted.</li>
- <li>Contributors <em>earn points</em> for all accepted verbs they suggested.</li>
- <li>The <em>vote weight</em> is dependent on the number of points a user has.</li>
-</ul>
-
-<p>
- If you have any questions, please write me at <a href="mailto:info@camilstaps.nl">info@camilstaps.nl</a>.
-</p>
-
-@if(Auth::check())
- <hr/>
- <div class="row">
- <div class="col-md-6">
- @include('suggestions')
- </div>
- <div class="col-lg-4 col-md-6">
- @include('suggest')
- </div>
- <div class="col-lg-2 col-md-6">
- @include('add_root')
- </div>
- </div>
-
- <hr/>
-
- <div class="row">
- <div class="col-md-6 col-lg-4">
- @include('user.top')
- </div>
- </div>
-@endif
-
-@endsection
diff --git a/resources/views/layouts/master.blade.php b/resources/views/layouts/master.blade.php
index 6a472e3..faf8aa2 100644
--- a/resources/views/layouts/master.blade.php
+++ b/resources/views/layouts/master.blade.php
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!--
-HebrewParseTrainer - practice Hebrew verbs
-Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+Luo Parse Trainer - practice Ancient Greek verb forms
+Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -16,20 +16,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
-<?php
-use Illuminate\Support\Facades\Auth;
-use Illuminate\Support\Facades\Request;
-
-$activePage = isset($activePage) ? $activePage : '';
-$menu = [
- 'Train' => ['/', ''],
-];
-
-if (Auth::check()) {
- $menu['Contribute'] = ['contribute', 'contribute'];
- $menu['Statistics'] = ['stats', 'stats'];
-}
-?>
<html lang="en">
<head>
<meta charset="utf-8"/>
@@ -38,7 +24,7 @@ if (Auth::check()) {
<title>ParseTrainer</title>
<link rel="stylesheet" href="{{ asset('vendor/twbs/bootstrap/dist/css/bootstrap.min.css') }}"/>
- <link rel="stylesheet" href="{{ asset('public/css/hebrewparsetrainer.css') }}"/>
+ <link rel="stylesheet" href="{{ asset('public/css/luoparsetrainer.css') }}"/>
<script type="text/javascript">
var app_url = '{{ env('APP_URL') }}';
@@ -48,16 +34,6 @@ if (Auth::check()) {
<body role="application">
<div class="container" role="main">
<div class="header clearfix">
- <nav>
- <ul class="nav nav-pills pull-right">
- @foreach($menu as $name => $link)
- <li role="presentation" class="{{ Request::is($link[0]) ? 'active' : '' }}"><a href="{{ url($link[1]) }}">{{ $name }}</a></li>
- @endforeach
- @if(Auth::check())
- <li role="presentation"><a href="{{ url('/logout') }}" onclick="event.preventDefault();document.getElementById('logout-form').submit();">Logout</a></li>
- @endif
- </ul>
- </nav>
<h2 class="text-muted"><a href="{{ url('/') }}">ParseTrainer</a></h2>
</div>
@@ -66,14 +42,6 @@ if (Auth::check()) {
<script src="{{ asset('vendor/components/jquery/jquery.min.js') }}"></script>
<script src="{{ asset('vendor/twbs/bootstrap/dist/js/bootstrap.min.js') }}"></script>
- <script src="{{ asset('public/js/alerts.js') }}"></script>
- <script src="{{ asset('public/js/hebrewparsetrainer.js') }}"></script>
- @if(Auth::check())
- <script src="{{ asset('public/js/moderators.js') }}"></script>
-
- <form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display:none;">
- {{ csrf_field() }}
- </form>
- @endif
+ <script src="{{ asset('public/js/luoparsetrainer.js') }}"></script>
</body>
</html>
diff --git a/resources/views/mails/user/create.blade.php b/resources/views/mails/user/create.blade.php
deleted file mode 100644
index 4094dfd..0000000
--- a/resources/views/mails/user/create.blade.php
+++ /dev/null
@@ -1,13 +0,0 @@
-Dear {{ $user->name }},
-
-Thank you for creating an account at the Hebrew Parse Trainer.
-
-You can now login at {{ URL::to('/contribute?login=yes') }}, using your email address and password.
-
-If you need any help, you can reach us at {{ env('MAIL_FROM_ADDRESS') }}.
-
-Thank you for your help!
-
-Best,
-
-{{ env('MAIL_FROM_NAME') }}
diff --git a/resources/views/shared/already_logged_in.blade.php b/resources/views/shared/already_logged_in.blade.php
deleted file mode 100644
index 37725fa..0000000
--- a/resources/views/shared/already_logged_in.blade.php
+++ /dev/null
@@ -1 +0,0 @@
-You are already logged in.
diff --git a/resources/views/shared/messages.blade.php b/resources/views/shared/messages.blade.php
deleted file mode 100644
index 67feae5..0000000
--- a/resources/views/shared/messages.blade.php
+++ /dev/null
@@ -1,5 +0,0 @@
-@if(isset($messages))
-@foreach($messages as $message)
- <div class="alert alert-{{{ $message[0] }}}" role="alert">{{{ $message[1] }}}</div>
-@endforeach
-@endif
diff --git a/resources/views/stats.blade.php b/resources/views/stats.blade.php
deleted file mode 100644
index eb4205f..0000000
--- a/resources/views/stats.blade.php
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-use \HebrewParseTrainer\RandomLog;
-
-$db_stats = RandomLog
- ::select(
- DB::raw('COUNT(*) as count'),
- DB::raw('DATE(created_at) as created_at'))
- ->groupBy(DB::raw('DATE(created_at)'))
- ->orderBy('created_at')
- ->get();
-
-$stats['requests'] = [];
-$last_date = null;
-foreach ($db_stats as $stat) {
- $date = strtotime($stat->created_at);
- while ($last_date != null && $last_date + 86400 < $date) {
- $last_date += 86400;
- $stats['requests'][] = "[Date.UTC" . date("(Y,n-1,j)", $last_date) . ",0]";
- }
- $stats['requests'][] = "[Date.UTC" . date("(Y,n-1,j)", $date) . "," . $stat->count . "]";
- $last_date = $date;
-}
-$stats['requests'] = "[" . implode(",", $stats['requests']) . "]";
-
-$db_stats = RandomLog
- ::select(
- DB::raw('COUNT(DISTINCT `ip`) as count'),
- DB::raw('DATE(created_at) as created_at'))
- ->groupBy(DB::raw('DATE(created_at)'))
- ->orderBy('created_at')
- ->get();
-
-$stats['unique-ips'] = [];
-$last_date = null;
-foreach ($db_stats as $stat) {
- $date = strtotime($stat->created_at);
- while ($last_date != null && $last_date + 86400 < $date) {
- $last_date += 86400;
- $stats['unique-ips'][] = "[Date.UTC" . date("(Y,n-1,j)", $last_date) . ",0]";
- }
- $stats['unique-ips'][] = "[Date.UTC" . date("(Y,n-1,j)", $date) . "," . $stat->count . "]";
- $last_date = $date;
-}
-$stats['unique-ips'] = "[" . implode(",", $stats['unique-ips']) . "]";
-?>
-
-@extends('layouts.master')
-
-@section('master-content')
-<div class="row">
- <div class="col-lg-12">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">Random verb requests</h3>
- </div>
- <div class="panel-body">
- <div id="random-requests" style="height:400px;"></div>
- </div>
- </div>
- </div>
-</div>
-
-<script src="{{ url("/vendor/components/jquery/jquery.min.js") }}"></script>
-<script src="{{ url("/vendor/twbs/bootstrap/dist/js/bootstrap.min.js") }}"></script>
-<script src="//code.highcharts.com/stock/highstock.js"></script>
-<script src="{{ url("/public/js/hebrewparsetrainer.js") }}"></script>
-
-<script type="text/javascript">
- $('#random-requests').highcharts('StockChart', {
- chart: {
- type: 'column',
- zoomType: 'x'
- },
- credits: { enabled: false },
- xAxis: { ordinal: false },
- yAxis: [
- {
- min: 0,
- title: { text: 'Requests' },
- opposite: false
- }, {
- min: 0,
- title: { text: 'Unique visitors' },
- opposite: true
- }
- ],
- rangeSelector: {
- buttons: [
- {type: 'week', count: 1, text: '1w'},
- {type: 'month', count: 1, text: '1m'},
- {type: 'month', count: 3, text: '3m'},
- {type: 'year', count: 1, text: '1y'},
- {type: 'all', text: 'All'}
- ],
- selected: 3
- },
- plotOptions: {
- column: {
- dataGrouping: {
- groupPixelWidth: 80,
- units: [
- ['day', [1]],
- ['week', [1]],
- ['month', [1]],
- ['month', [3]],
- ['year', [1]]
- ]
- },
- pointPadding: 0.02,
- groupPadding: 0.02
- },
- series: {
- dataGrouping: {
- approximation: 'sum'
- }
- }
- },
- tooltip: { pointFormat: '<b>{point.y}</b> requests<br>' },
- series: [
- {
- name: 'Requests',
- data: {{ $stats['requests'] }}
- },
- {
- type: 'spline',
- yAxis: 1,
- name: 'Unique visitors',
- data: {{ $stats['unique-ips'] }},
- tooltip: { pointFormat: '<b>{point.y}</b> unique visitors' },
- }
- ]
- });
-</script>
-@endsection
diff --git a/resources/views/suggest.blade.php b/resources/views/suggest.blade.php
deleted file mode 100644
index 1e5c424..0000000
--- a/resources/views/suggest.blade.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-use HebrewParseTrainer\Root;
-use HebrewParseTrainer\Stem;
-use HebrewParseTrainer\Tense;
-use HebrewParseTrainer\Verb;
-?>
-<div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">Suggest a new verb</h3>
- </div>
- <div class="panel-body">
- <form class="form-horizontal" id="suggest">
- <input type="hidden" name="_token" value="{{ csrf_token() }}">
- <div class="alerts"></div>
- <div class="form-group">
- <label for="suggest-verb" class="col-sm-2 control-label">Verb</label>
- <div class="col-sm-10">
- <input type="text" class="form-control hebrew input-lg" id="suggest-verb" name="verb" placeholder="קָטַל"/>
- </div>
- </div>
- <div class="form-group">
- <label for="suggest-root" class="col-sm-2 control-label">Root</label>
- <div class="col-sm-10">
- <select id="suggest-root" class="form-control hebrew input-lg" name="root">
- @foreach(Root::orderBy('root')->get() as $root)
- <option value="{{ $root->root }}">{{{ $root->root }}}</option>
- @endforeach
- </select>
- </div>
- </div>
- <div class="form-group">
- <label for="suggest-stem" class="col-sm-2 control-label">Stem</label>
- <div class="col-sm-10">
- <select id="suggest-stem" class="form-control" name="stem">
- @foreach(Stem::orderBy('id')->get() as $stem)
- <option value="{{ $stem->name }}">{{{ $stem->name }}}</option>
- @endforeach
- </select>
- </div>
- </div>
- <div class="form-group">
- <label for="suggest-tense" class="col-sm-2 control-label">Tense</label>
- <div class="col-sm-10">
- <select id="suggest-tense" class="form-control" name="tense">
- @foreach(Tense::all() as $tense)
- <option value="{{ $tense->name }}">{{{ $tense->abbreviation }}}: {{{ $tense->name }}}</option>
- @endforeach
- </select>
- </div>
- </div>
- <div class="form-group">
- <label for="suggest-person" class="col-sm-2 control-label">Person</label>
- <div class="col-sm-10">
- <select id="suggest-person" class="form-control" name="person">
- <option value="">(none)</option>
- <option value="1">1</option>
- <option value="2">2</option>
- <option value="3">3</option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label for="suggest-gender" class="col-sm-2 control-label">Gender</label>
- <div class="col-sm-10">
- <select id="suggest-gender" class="form-control" name="gender">
- <option value="">(none)</option>
- <option value="m">masculine</option>
- <option value="f">feminine</option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label for="suggest-number" class="col-sm-2 control-label">Number</label>
- <div class="col-sm-10">
- <select id="suggest-number" class="form-control" name="number">
- <option value="">(none)</option>
- <option value="s">singular</option>
- <option value="p">plural</option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <div class="col-sm-offset-2 col-sm-10">
- <button type="submit" class="btn btn-primary">Suggest</button>
- </div>
- </div>
- </form>
- </div>
-</div>
diff --git a/resources/views/suggestions.blade.php b/resources/views/suggestions.blade.php
deleted file mode 100644
index 68ad049..0000000
--- a/resources/views/suggestions.blade.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-use HebrewParseTrainer\Verb;
-
-$suggestions = Verb::where('active', 0)
- ->orderBy('root')
- ->orderBy('stem', 'desc')
- ->orderBy('tense', 'desc')
- ->orderBy('number')
- ->orderBy('person', 'desc')
- ->orderBy('gender')
- ->get();
-?>
-<div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">Current suggestions</h3>
- </div>
- <div class="panel-body">
- <table class="table table-hover table-condensed suggestions">
- <thead>
- <tr>
- <th>Verb</th>
- <th>Root</th>
- <th>Parsing</th>
- <th colspan="3">Votes</th>
- </tr>
- </thead>
- <tbody>
- @forelse($suggestions as $verb)
- <tr>
- <td class="large hebrew text-center">{{ $verb->verb }}</td>
- <td class="large hebrew text-center">{{ $verb->root }}</td>
- <td>{{ $verb->stem }} {{ $verb->tense }} {{ $verb->person }}{{ $verb->gender }}{{ $verb->number }}</td>
- <td class="vote-cell"><button data-vote="0" data-verb="{{ $verb->id }}" class="vote btn btn-{{ $verb->userVote(Auth::user()) < 0 ? 'danger' : 'default' }}">-</button></td>
- <td class="vote-cell"><span class="vote-count btn">{{ $verb->voteCount() }}</span></td>
- <td class="vote-cell"><button data-vote="1" data-verb="{{ $verb->id }}" class="vote btn btn-{{ $verb->userVote(Auth::user()) > 0 ? 'success' : 'default' }}">+</button></td>
- </tr>
- @empty
- <tr><td colspan="4">There are no active suggestions. Why not add a verb yourself?</td></tr>
- @endforelse
- </tbody>
- </table>
- </div>
-</div>
diff --git a/resources/views/trainer.blade.php b/resources/views/trainer.blade.php
index ea0c141..c73dcd3 100644
--- a/resources/views/trainer.blade.php
+++ b/resources/views/trainer.blade.php
@@ -1,26 +1,17 @@
<?php
use HebrewParseTrainer\Root;
-use HebrewParseTrainer\Stem;
+use HebrewParseTrainer\Mode;
use HebrewParseTrainer\Tense;
?>
@extends('layouts.with_sidebar')
@section('sidebar')
-<form id="hebrewparsetrainer-settings">
+<form id="luoparsetrainer-settings">
<input type="hidden" id="csrf" value="{{ csrf_token() }}"/>
<div class="form-group">
- <h3>Stems</h3>
- @foreach (Stem::all() as $stem)
- <div class="checkbox">
- <label><input class="reload-verb" type="checkbox" name="stem" value="{{{ $stem->name }}}" checked="checked"/> {{{ $stem->name }}}</label>
- </div>
- @endforeach
- </div>
-
- <div class="form-group">
- <h3>Tenses</h3>
+ <h3>Tempora</h3>
@foreach (Tense::all() as $tense)
<div class="checkbox">
<label><input class="reload-verb" type="checkbox" name="tense" value="{{{ $tense->name }}}" checked="checked"/> {{{ $tense->name }}}</label>
@@ -29,14 +20,12 @@ use HebrewParseTrainer\Tense;
</div>
<div class="form-group">
- <h3>Roots</h3>
- <select name="root" class="reload-verb form-control hebrew ltr" multiple="multiple">
- @foreach (Root::orderBy('root_kind_id')->orderBy('root')->get() as $root)
- @if ($root->verbs()->where('active', 1)->count() > 0)
- <option value="{{{ $root->root }}}" selected="selected">{{{ $root->root }}} ({{{ $root->kind->name }}})</option>
- @endif
+ <h3>Modi</h3>
+ @foreach (Mode::all() as $mode)
+ <div class="checkbox">
+ <label><input class="reload-verb" type="checkbox" name="mode" value="{{{ $mode->name }}}" checked="checked"/> {{{ $mode->name }}}</label>
+ </div>
@endforeach
- </select>
</div>
<div class="form-group">
@@ -52,39 +41,30 @@ use HebrewParseTrainer\Tense;
<div id="trainer">
<div id="trainer-input-container">
<p class="bg-danger" id="trainer-404">There are no verbs matching the criteria in our database.</p>
- <p class="lead"><span class="hebrew hebrew-large" id="trainer-verb"></span><span id="trainer-answer"></span></p>
+ <p class="lead"><span class="greek greek-large" id="trainer-verb"></span><span id="trainer-answer"></span></p>
</div>
<div id="trainer-input-fancy"></div>
<div class="text-muted">
<div id="trainer-input-help">
- <p>Parse the verb and enter the answer as described below. Press return. If your answer was correct and there are multiple possible parsings, an extra input field will appear. After the first incorrect answer or after entering all possible answers, you can continue to the next verb by pressing return once more.</p>
<p>
- <strong>Stems</strong>: either use the full name or a significant beginning (i.e. <code>Q</code> for Qal but <code>Pi</code> for Piel rather than <code>P</code>).<br/>
- <strong>Tenses</strong>: use the abbreviations <code>pf</code>, <code>ipf</code>, <code>coh</code>, <code>imp</code>, <code>jus</code>, <code>infcs</code>, <code>infabs</code>, <code>pta</code> and <code>ptp</code>.<br/>
- <strong>Person</strong>: <code>1</code>, <code>2</code>, <code>3</code> or none (infinitives and participles).<br/>
- <strong>Gender</strong>: <code>m</code>, <code>f</code> or none (infinitives).<br/>
- <strong>Number</strong>: <code>s</code>, <code>p</code> or none (infinitives).
+ Parseer de werkwoordsvorm en vul het antwoord in, gevolgd door <code>Enter</code>.
+ Als het antwoord correct is en er meerdere mogelijke antwoorden zijn, verschijnt er een extra invoerveld.
+ Na het eerste incorrecte antwoord, of als alle mogelijkheden zijn gegeven, kun je door naar de volgende vorm met <code>Enter</code>.
</p>
- <p><strong>Examples</strong>: <code>Q pf 3ms</code>, <code>ni pta fp</code>, <code>pi infabs</code>.</p>
- <p>You can also use the buttons to enter your answer. This is an experimental feature.</p>
- </div>
- <button type="button" class="btn btn-default btn-xs" id="show-hide-help">Show help</button>
- </div>
-</div>
-
-<hr/>
-
-<div class="row">
- <div class="col-md-12">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">About</h3>
- </div>
- <div class="panel-body">
- <p>&copy; 2015&ndash;{!! date('y') !!} <a href="https://camilstaps.nl">Camil Staps</a>. Licensed under <a href="http://www.gnu.org/licenses/gpl-3.0.en.html">GPL 3.0</a>. Source is on <a href="https://github.com/HebrewTools/ParseTrainer">GitHub</a>.</p>
- <p>Please report any mistakes to <a href="mailto:info@camilstaps.nl">info@camilstaps.nl</a>.</p>
- </div>
+ <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>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/>
+ <strong>Getal</strong> (indien van toepassing): e(nkel)v(oud) of m(eer)v(oud).
+ </p>
+ <p><strong>Voorbeelden</strong>: <code>pr ind A 1 ev</code>, <code>fut inf M</code>, <code>pqpf ptc P M nom ev</code>.</p>
+ <p>Je kunt ook de knoppen gebruiken om een vorm te parseren.</p>
+ <p>&copy; 2015&ndash;{!! date('y') !!} <a href="https://camilstaps.nl">Camil Staps</a>. Gelicenseerd onder <a href="http://www.gnu.org/licenses/gpl-3.0.en.html">GPL 3.0</a>. De broncode staat op <a href="https://git.camilstaps.nl/luo-parsetrainer.git">git.camilstaps.nl/luo-parsetrainer.git</a>.</p>
</div>
+ <button type="button" class="btn btn-default btn-xs" id="show-hide-help">Meer informatie</button>
</div>
</div>
diff --git a/resources/views/user/create.blade.php b/resources/views/user/create.blade.php
deleted file mode 100644
index b823451..0000000
--- a/resources/views/user/create.blade.php
+++ /dev/null
@@ -1,32 +0,0 @@
-@extends('layouts.master')
-
-@section('master-content')
-
-@if(Auth::check())
- @include('shared.already_logged_in')
-@else
- @include('shared.messages')
-
- <form method="post">
- <div class="form-group">
- <label for="create-user-email">Email address (private)</label>
- <input type="email" class="form-control" id="create-user-email" placeholder="Email" name="email" value="{{{ $form['email'] }}}" aria-describedby="create-user-email-help"/>
- <span id="create-user-email-help" class="help-block">You will not receive any automated email from us, but we like to have some way of contacting you available. Your email address will not be shared with third parties, and will not be visible to users of the website.</span>
- </div>
- <div class="form-group">
- <label for="create-user-name">Username</label>
- <input type="text" class="form-control" id="create-user-name" placeholder="Username" name="name" value="{{{ $form['name'] }}}" aria-describedby="create-user-name-help"/>
- <span id="create-user-name-help" class="help-block">Your name as shown on the site.</span>
- </div>
- <div class="form-group">
- <label for="create-user-pw1">Password</label>
- <input type="password" class="form-control" id="create-user-pw1" placeholder="Password" name="password"/>
- </div>
- <div class="form-group">
- <input type="password" class="form-control" id="create-user-pw2" placeholder="Password (confirmation)" name="password_confirmation"/>
- </div>
- <button type="submit" class="btn btn-primary">Create account</button>
- </form>
-@endif
-
-@endsection
diff --git a/resources/views/user/top.blade.php b/resources/views/user/top.blade.php
deleted file mode 100644
index eeeafde..0000000
--- a/resources/views/user/top.blade.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-use HebrewParseTrainer\User;
-
-$users = User::where('isadmin', false)
- ->orderBy('points', 'desc')
- ->take(3)
- ->get();
-?>
-@if(count($users) > 0)
-<div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">Top contributors</h3>
- </div>
- <div class="panel-body">
- <table class="table table-hover">
- <thead>
- <tr>
- <th></th>
- <th>Name</th>
- <th>Points</th>
- </tr>
- </thead>
- <tbody>
- @foreach($users as $user)
- <tr>
- <td><a href="http://gravatar.com"><img src="https://gravatar.com/avatar/{{ md5(strtolower(trim($user->email))) }}?s=40"/></a></td>
- <td>{{{ $user->name }}}</td>
- <td>{{{ $user->points }}}</td>
- </tr>
- @endforeach
- </tbody>
- </table>
-
- @if(Auth::check())
- <p>You have {{ Auth::user()->points }} points.</p>
- @endif
- </div>
-</div>
-@endif
diff --git a/routes/web.php b/routes/web.php
index a4d1007..58e592f 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -1,7 +1,7 @@
<?php
/**
- * HebrewParseTrainer - practice Hebrew verbs
- * Copyright (C) 2015 Camil Staps <info@camilstaps.nl>
+ * Luo Parse Trainer - practice Ancient Greek verb forms
+ * Copyright (C) 2015-present Camil Staps <info@camilstaps.nl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,35 +28,15 @@ Route::group(
});
Route::get('/stem', function () {
- return \HebrewParseTrainer\Stem::all();
+ return \HebrewParseTrainer\Mode::all();
});
Route::get('/tense', function () {
return \HebrewParseTrainer\Tense::all();
});
- Route::post('/verb/random',
- '\App\Http\Controllers\VerbController@random');
-
- Route::get('/contribute', function () {
- return view('contribute');
- });
-
- Route::group(['middleware' => 'auth'], function () {
- Route::get('/stats', function () {
- return view('stats');
- });
-
- Route::get('/verb/{id}/vote/{choice}',
- '\App\Http\Controllers\VerbController@vote');
-
- Route::post('/verb/suggest',
- '\App\Http\Controllers\VerbController@suggest');
-
- Route::post('/root/create',
- '\App\Http\Controllers\RootController@create');
-
- });
+ Route::post('/form/random',
+ '\App\Http\Controllers\FormController@random');
});
diff --git a/tools/import_etcbc.py b/tools/import_etcbc.py
deleted file mode 100755
index 4d752e7..0000000
--- a/tools/import_etcbc.py
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/usr/bin/env python3
-
-from tf.fabric import Fabric
-import csv
-import re
-
-VERB_STARTID=13
-ROOT_STARTID=2
-
-STEMS = {
- 'qal': 'Qal',
- 'hif': 'Hiphil',
- 'piel': 'Piel',
- 'nif': 'Niphal',
- 'hit': 'Hitpael',
- 'pual': 'Pual',
- 'hof': 'Hophal'
- }
-
-TENSES = {
- 'perf': 'perfect',
- 'impf': 'imperfect',
- #'wayq': 'wayyiqtol',
- 'ptca': 'participle active',
- 'infc': 'infinitive construct',
- 'impv': 'imperative',
- 'ptcp': 'participle passive',
- 'infa': 'infinitive absolute'
- }
-
-PERSONS = {'p1': 1, 'p2': 2, 'p3': 3, 'unknown': None}
-GENDERS = {'m': 'm', 'f': 'f', 'unkown': None}
-NUMBERS = {'sg': 's', 'pl': 'p', 'unknown': None}
-
-class Root:
- def __init__(self, n):
- self.lex = F.lex_utf8.v(n)
-
- def __eq__(self, other):
- return self.lex == other.lex
-
- def __hash__(self):
- return hash(self.lex)
-
-class Verb:
- def __init__(self, n):
- self.n = n
- verb = F.g_word_utf8.v(n)
- if verb is None or '\u05c3' in verb or '\u05be' in verb:
- raise ValueError('no text, sof pasuq or maqaf')
- # strip accents
- self.verb = re.sub(r'[^\u05b0-\u05bc\u05c1\u05c2\u05c7-\u05ea]', '', verb)
- self.root = F.lex_utf8.v(n)
- self.stem = STEMS[F.vs.v(n)]
- self.tense = TENSES[F.vt.v(n)]
- self.person = PERSONS[F.ps.v(n)]
- self.gender = GENDERS[F.gn.v(n)]
- self.number = NUMBERS[F.nu.v(n)]
- self.loc = T.sectionFromNode(n)
-
- def unpointed_word(self):
- return re.sub(r'[^\u05d0-\u05ea]', '', self.verb)
-
- def __eq__(self, other):
- return self.unpointed_word() == other.unpointed_word() and \
- self.root == other.root and \
- self.stem == other.stem and \
- self.tense == other.tense and \
- self.person == other.person and \
- self.gender == other.gender and \
- self.number == other.number
-
- def __hash__(self):
- return hash((self.unpointed_word(), self.root, self.stem, self.tense,
- self.person, self.gender, self.number))
-
-class Databank:
- def __init__(self):
- self.verbs = set()
- self.roots = set()
-
- def add_root(self, root):
- self.roots.add(root)
-
- def add_verb(self, verb):
- self.verbs.add(verb)
-
-def handle(n, data):
- if F.language.v(n) != 'hbo': # Ancient Hebrew
- return
- data.add_verb(Verb(n))
- data.add_root(Root(n))
-
-def main():
- TF = Fabric(
- modules=['hebrew/etcbc4c'],
- locations='~/VersionControl/etcbc-data',
- silent=True)
- api = TF.load('language g_word_utf8 lex_utf8 vs vt gn nu ps', silent=True)
- api.makeAvailableIn(globals())
-
- data = Databank()
-
- for n in N():
- try:
- handle(n, data)
- except (KeyError, ValueError):
- pass
-
- print(len(data.verbs), len(data.roots))
-
- with open('etcbc-verbs.csv', 'w') as csvverbs:
- verbwr = csv.writer(csvverbs, quoting=csv.QUOTE_MINIMAL)
- #verbwr.writerow(['id', 'verb','root','stem','tense','person','gender','number','active'])
- i = VERB_STARTID
- for verb in data.verbs:
- verbwr.writerow([
- i,
- verb.verb,
- verb.root,
- verb.stem,
- verb.tense,
- verb.person if verb.person is not None else 'NULL',
- verb.gender if verb.gender is not None else 'NULL',
- verb.number if verb.number is not None else 'NULL',
- 1
- ])
- i += 1
-
- with open('etcbc-roots.csv', 'w') as csvroots:
- rootwr = csv.writer(csvroots, quoting=csv.QUOTE_MINIMAL)
- #rootwr.writerow(['id', 'root', 'root_kind_id'])
- i = ROOT_STARTID
- for root in data.roots:
- rootwr.writerow([i, root.lex, 1])
- i += 1
-
-
-if __name__ == '__main__':
- main()